* exclude leading The or A from the acronym
This commit is contained in:
parent
787b3e241a
commit
7560ba048f
|
@ -97,7 +97,7 @@ String.metaClass.upperInitial = { replaceAll(/(?<=[&()+.,-;<=>?\[\]_{|}~ ]|^)[a-
|
||||||
*
|
*
|
||||||
* e.g. "Deep Space 9" -> "DS9"
|
* e.g. "Deep Space 9" -> "DS9"
|
||||||
*/
|
*/
|
||||||
String.metaClass.acronym = { findAll(/(?<=[&()+.,-;<=>?\[\]_{|}~ ]|^)[\p{Alnum}]/).join().toUpperCase() }
|
String.metaClass.acronym = { delegate.after(/^(?i)(The|A)\s/).trim().findAll(/(?<=[&()+.,-;<=>?\[\]_{|}~ ]|^)[\p{Alnum}]/).join().toUpperCase() }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lower-case all letters that are not initials.
|
* Lower-case all letters that are not initials.
|
||||||
|
|
Loading…
Reference in New Issue