CARL Source allows you to indicate conversions applied to Exchange standards to:
Conversions apply to:
In the expression for a conversion, the symbol $ represents the variable to which the function is applied.
If the semicolon character ";" is to be included in a setting in the expression (string), it must be preceded by the backslash character "\."
Conversions can be cumulative, as shown in the following examples.
Conversions on strings
|
Purpose |
Function |
Comment |
|
Put in upper case |
$.toUpperCase() |
|
|
Assign a constant |
"string" |
|
|
Concatenate a string |
$ + "string" |
|
|
Extract a sub-string |
$.substring(Start,End) |
Start and end are position in the sub-string, starting with 0. |
|
Remove spaces to the right and left |
$.replace(/^\s+|\s+$/g, ''); |
|
|
Replace a string with another in a string |
$.replace("string1," "string2") |
Replace only the first occurrence of "string1" |
|
$.replace(/string1/g, "string2") |
Replace all occurrences of "string1" |
|
|
Position of a sub-string in a string |
$.indexOf("string") |
Examples:
$.substring(0,5).replace(/ /g, "-").toUpperCase(): Returns the first 5 characters of the string in upper case, in which spaces are replaced with dashes.
$.substring($.indexOf("[")+1,$.indexOf("]")): Returns the sub-string between square brackets [ ].
Conversions on numerical values
|
Purpose |
Function |
Comment |
|
Apply an operation |
$ + constant $ - constant $/constant $ * constant |
|
|
Round a number |
Math.round($) |
Rounds to the nearest whole number |
|
Math.round($*100)/100 |
Rounds to two decimals. |
|
|
Round to the next lowest value (for truncating a number) |
Math.floor($) |
Rounds to the next lowest whole number |
|
Math.floor($*100)/100 |
Rounds to the next lowest hundredth |
|
|
Obtain the absolute value |
Math.abs($) |
|
|
Obtain the smaller of two numbers |
Math.min($,5) |