All about user-defined episode / movie / file name format expressions
devster
Posts: 417 Joined: 06 Jun 2017, 22:56
Post
by devster » 28 Jul 2019, 13:28
Just a small thread to share replacement characters for titles and series names.
Code: Select all
def norm = { it.replaceAll(/[:]/, "\u2236") // "∶" Ratio symbol
.replaceAll(/[:]/, "\uFF1A") // ":" Fullwidth Colon
.replaceAll(/[:]/, "\uFE55") // "﹕" Small Colon
.replaceAll("/", "\u29F8") // "⧸" Big Solidus
.replaceAll("/", "\u2215") // "∕" Division Slash
.replaceAll("/", "\u2044") // "⁄" Fraction Slash
.replaceAll(/[?]/, "\uFE56") // "﹖" Small Question Mark
}
// remove or comment the ones you don't want
Character appearance may vary depending on your font, in some cases fonts may not have a particular character.
I only work in black and sometimes very, very dark grey. (Batman)
rednoah
The Source
Posts: 23940 Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:
Post
by rednoah » 28 Jul 2019, 19:27
Do we want a built-in convenience method for this operation?
How TF should I name this method!?
devster
Posts: 417 Joined: 06 Jun 2017, 22:56
Post
by devster » 28 Jul 2019, 23:31
I don't believe it's necessary, there already are the .colon and .slash methods (which I forgot above), the rest can be done with a replaceAll.
In any case a possible name could be "pathsub" or "substitute".
I only work in black and sometimes very, very dark grey. (Batman)
rednoah
The Source
Posts: 23940 Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:
Post
by rednoah » 29 Jul 2019, 16:29
I guess it's just 3 replacements for now, and that can be expressed with little code already:
Code: Select all
'Test: A / ?'.replace(
':':'∶',
'/':'∕',
'?':'﹖'
)
Let's leave it at that for now. Mainly because I can't come up with a good method name.