1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-08-13 17:03:45 -04:00

* short-hand for "Put the The|A|An at the end

This commit is contained in:
Reinhard Pointner 2013-10-20 04:21:22 +00:00
parent bdbc4571be
commit 86d448a5d8

View File

@ -97,7 +97,8 @@ String.metaClass.upperInitial = { replaceAll(/(?<=[&()+.,-;<=>?\[\]_{|}~ ]|^)[a-
* *
* e.g. "Deep Space 9" -> "DS9" * e.g. "Deep Space 9" -> "DS9"
*/ */
String.metaClass.acronym = { delegate.after(/^(?i)(The|A|An)\s/).trim().findAll(/(?<=[&()+.,-;<=>?\[\]_{|}~ ]|^)[\p{Alnum}]/).join().toUpperCase() } String.metaClass.acronym = { delegate.sortName('$2').findAll(/(?<=[&()+.,-;<=>?\[\]_{|}~ ]|^)[\p{Alnum}]/).join().toUpperCase() }
String.metaClass.sortName = { replacement = '$2, $1' -> delegate.replaceFirst(/^(?i)(The|A|An)\s(.+)/, replacement).trim() }
/** /**
* Lower-case all letters that are not initials. * Lower-case all letters that are not initials.