1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-25 09:18:51 -05:00

* keep 8 recently used expressions around

* added acronym() function
This commit is contained in:
Reinhard Pointner 2012-07-15 09:22:02 +00:00
parent b4706ac468
commit a5f75ca7ae
2 changed files with 9 additions and 2 deletions

View File

@ -64,6 +64,13 @@ String.metaClass.space = { replacement -> replaceAll(/[:?._]/, " ").trim().repla
String.metaClass.upperInitial = { replaceAll(/(?<=[&()+.,-;<=>?\[\]_{|}~ ]|^)[a-z]/, { it.toUpperCase() }) } String.metaClass.upperInitial = { replaceAll(/(?<=[&()+.,-;<=>?\[\]_{|}~ ]|^)[a-z]/, { it.toUpperCase() }) }
/**
* Get acronym, i.e. first letter of each word.
*
* e.g. "Deep Space 9" -> "DS9"
*/
String.metaClass.acronym = { findAll(/(?<=[&()+.,-;<=>?\[\]_{|}~ ]|^)[\p{Alnum}]/).join().toUpperCase() }
/** /**
* Lower-case all letters that are not initials. * Lower-case all letters that are not initials.
* *

View File

@ -627,11 +627,11 @@ class FormatDialog extends JDialog {
// add new format first // add new format first
recent.add(format.getExpression()); recent.add(format.getExpression());
// add next 4 most recent formats // save the 8 most recent formats
for (String expression : mode.persistentFormatHistory()) { for (String expression : mode.persistentFormatHistory()) {
recent.add(expression); recent.add(expression);
if (recent.size() >= 5) { if (recent.size() >= 8) {
break; break;
} }
} }