## Scripting

Tagscanner has built-in scripting engine which allow you to make advanced things on any text output. The syntax was inspired 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.
$if2(x1,x2,x3,...) | Returns first non-empty argument.
$left(x,n) | Returns first N characters from X.
$right(x,n) | Returns last N characters from X.
$cut(x,n) | Truncates X on N characters.
$trim(x) | Trims all leading and trailing whitespaces from X.
$padleft(x,n,c), $padright(x,n,c) | Pads X with C character up to N characters. C setted up to space by default.
$len(x) | Returns number of characters in X.
$strpos(x,y) | Returns position of Y in X.
$substr(a,x,y) | Returns substring of string A, starting from X-th character and ending at Y-th character.
$insert(a,b,n) | Inserts string B into string A after N characters.
$getpart(x,n,c) | Returns N-th part of string X splited by C character. C setted up to space by default.
$char(x) | Returns unicode character number X.
$ansi(x) | Returns X with all characters not present in current system codepage replaced with closest matches
$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.
$isnumber(x) | Returns true, if X is number.
$in(x,y) | Returns true, if X contains Y.
Arithmetic functions
$add(x,y) | Add Y to X.
$sub(x,y) | Subtracts Y from X.
$div(x,y) | Divides X by Y.
$min(x,y) | Returns minimum value.
$max(x,y) | Returns maximum value.
$round(x) | Returns rounded x.
$mod(x,y) | Returns the remainder of X divided by Y.
$mul(x,y) | Multiplies X by Y.