## Scripting

Tagscanner has built-in scripting engine which allow you to make advanced things on any text output. The syntax was insipred from Foobar2000's titleformat.
Functions start with a dollar sign and end with an arguments enclosed in parentheses (e.g. $lower(...)).

Functions and placeholders gives to you very wide abilities to beautify tags and filenames.

Put the single quote around reserved characters % , $ , [ , ] if you want to use them directly.

String functions
[...] | Displays contents inside brackets when at least one placeholder not empty
$lower(x) | Returns X in lowercase.
$upper(x) | Returns X in uppercase.
$caps(x) | Converts first letter in every word of X to uppercase, and all other letters to lowercase, e.g. “blah BLAH” ⇒ “Blah Blah”.
$caps2(x) | Converts first letter in every word of X to uppercase, and all other letters to lowercase, ignoring uppercase letters e.g. “blah BLAH” ⇒ “Blah BLAH”.
$if(x,a,b) | If X not empty, executes/displays A, otherwise executes/displays B.
$left(x,n) | Returns first N characters from X.
$right(x,n) | Returns last N characters from X.
$cut(x,n) | Truncates X to N characters.
$trim(x) | Trims all leading and trailing whitespaces from X.
$len(x) | Returns number of characters in X.
$strpos(x,y) | Returns position of Y in X.
$char(x) | Returns unicode character number X.
$num(x,n) | Displays X formatted with zeros up to N characters.
$name(field) | Return localized FIELD name
$replace(x,from,to) | Replaces all occurrences of string FROM in string X with string TO.
$cutmix(x) | Removes mix/cover part in parentheses from X
$stripprefix(x) | Removes “A” and “The” prefixes from X.
$swapprefix(x) | Moves “A” and “The” prefixes to the end of X.
Boolean functions
$equal(x,y) | Returns true, if X equals Y. (case insensitive)
$nequal(x,y) | Returns true, if X not equals Y. (case insensitive)
$and(x,y) | Returns true, if both X and Y are not empty.
$or(x,y) | Returns true, if either X or Y not empty.
$not(x) | Returns true, if X is empty.
$greater(x,y) | Returns true, if X is greater than Y.
$longer(x,y) | Returns true, if X is longer than Y.
Arithmetic functions
$add(x,y) | Add Y to X.
$sub(x,y) | Subtracts Y from X.
$div(x,y) | Divides X by Y.
$mod(x,y) | Returns the remainder of X divided by Y.
$mul(x,y) | Multiplies X by Y.