Let's say we prefer acronyms:
"Deep Space 9" => "DS9"
"How I Met Your Mother" => "HIMYM"
1. Hardcode the name in your custom format:
Code: Select all
DS9 - {s00e00} - {t}
2. Use pattern matching and replacement:
Code: Select all
{
n.match(
'Deep Space 9' : 'DS9',
'How I Met Your Mother' : 'HIMYM'
) ?: n
}
3. Use character replacement:
Code: Select all
{
n.replace(
'Deep Space 9' : 'DS9',
'How I Met Your Mother' : 'HIMYM'
)
}
4. Use a custom lookup table:
Code: Select all
{
def table = [
'Deep Space 9' : 'DS9',
'How I Met Your Mother' : 'HIMYM'
]
table[n] ?: n
}
5. Use a custom lookup table read from an external TSV or CSV file:
Code: Select all
{
def table = csv('/path/to/names.tsv')
table[n] ?: n
}
Code: Select all
Deep Space 9 DS9
How I Met Your Mother HIMYM


6.
... or anything else you can come up with! Anything is possible!

"The IT Crowd (UK)" => "The IT Crowd"
Code: Select all
{ n.replaceTrailingBrackets() }
Code: Select all
{ n.acronym() }