ia.TextSubstitution Class
The TextSubstitution class contains functions for
variable subtitution in strings.
All variables are indicated by the name of the variable. This class registers these names
with variable values, allowing the lookup of variable values
by the variable name. The set of available variables can be extended by using
the static setVariable method to register a new variable name and
value.
Constructor
ia.TextSubstitution
()
Item Index
Methods
_formatValue
-
variableString -
index
Extracts a variable / string / number from a conditional statement.
Parameters:
-
variableStringStringThe conditional statement.
-
indexNumberThe position of the variable in the statement.
Returns:
_leftTrim
-
s
Removes whitespace from the left side of a string.
Parameters:
-
sStringThe string.
Returns:
_processVariable
-
variableString
Processes a conditional statement.
Parameters:
-
variableStringStringThe variable string.
_replace
-
s -
pattern -
replacement
Replaces a pattern in a string with a new pattern. eg. All occurrences of ";" may be replaced with ";".
Parameters:
-
sStringThe string.
-
patternStringThe pattern.
-
replacementStringThe pattern replacements.
Returns:
_rightTrim
-
s
Removes whitespace from the right side of a string.
Parameters:
-
sStringThe string.
Returns:
_trim
-
s
Removes whitespace from a string.
Parameters:
-
sStringThe string.
Returns:
clearVariables
()
Clears the variables.
formatMessage
-
msg
Replaces all instances of a variable name in a string with the 'real' values.
Parameters:
-
msgStringThe input string which may contain variable names, for example: 'Current theme is: ${themeName1}'.
Returns:
setVariable
-
name -
value
Sets the value for the given substitution variable.
Parameters:
-
nameStringThe name of the variable
-
valueStringThe value of the variable.