String
- Last Updated: December 12, 2022
- 1 minute read
- Corticon.js
- Documentation
Corticon.js's String attribute operators are as follows:
| Name and Syntax | Returns | Description | |
|---|---|---|---|
| Equals (used as a comparison) | |||
<String1> =
<String2> |
Boolean | Returns a value of true if <String1> exactly matches <String2>. Both case and length are examined to determine
equality. |
|
| Equals (used as an assignment) | |||
<String1> =
<String2> |
String | Assigns the value of <String2> to the value of <String1>. |
|
| Not Equal to | |||
<String1> <>
<String2> |
Boolean | Returns a value of true if <String1> is not equal to <String2>. |
|
| Less than | |||
<String1> <
<String2> |
Boolean | Returns a value of true if <String1> is less than <String2>. |
|
| Greater than | |||
<String1> >
<String2> |
Boolean | Returns a value of true if <String1> is greater than <String2>.
|
|
| Less than or Equal to | |||
<String1> <=
<String2> |
Boolean | Returns a value of true if <String1> is less than or equal to <String2>.
|
|
| Greater than or Equal to | |||
<String1> >=
<String2> |
Boolean | Returns a value of true if <String1> is greater than or equal to <String2>.
|
|
| In (Range) | |||
attributeReference in
[ |(rangeExpression)|]
|
Boolean | Returns a value of true if attributeReference is in the range of String values from..to, and where
opening and closing parentheses ( )indicate
exclusion of that limit and square brackets [
] indicate inclusion of that limit. |
|
| In (List) | |||
attributeReference in
{listExpression} |
Boolean | Returns a value of true if attributeReference is in the comma-delimited list of literal
values, defined enumeration values, or - if in use - enumeration labels.
|
|
| Adding Strings | |||
<String1> +
<String2> |
String | Concatenates <String1> to <String2>.
Alternative syntax. |
|
| Size | |||
<String>.size |
String | Returns the number of characters in <String>. |
|
| Concatenate | |||
<String1>.concat(<String2>) |
String | Concatenates <String1> to <String2>. |
|
| Uppercase | |||
<String>.toUpper |
String | Converts all characters <String> to uppercase. |
|
| Lowercase | |||
<String>.toLower |
String | Converts all characters in <String> to lowercase. |
|
| To DateTime | |||
<String>.toDateTime |
DateTime | Converts the value in <String> to data type DateTime ONLY if date as ISO8601 string or
millisecs since epoch as a string. |
|
| To Decimal | |||
<String>.toDecimal |
Decimal | Converts an attribute of type String to data type Decimal
ONLY if all characters in <String> are
numeric and contain not more than one decimal point. If any non-numeric
characters are present (other than a single decimal point or leading minus
sign), no value is returned. |
|
| To Integer | |||
<String>.toInteger |
Integer | Converts an attribute of type String to type Integer ONLY
if all characters in <String> are
numeric. If any non-numeric characters are present, no value is
returned. |
|
| Substring | |||
<String>.substring
(<Integer1>,<Integer2>) |
String | Returns that portion of <String> between character positions <Integer1> and Integer2>. |
|
| Equals Ignoring Case | |||
<String1>.equalsIgnoreCase (<String2>) |
Boolean | Returns a value of true if <String1> is the same as <String2>, irrespective of case. |
|
| Starts with | |||
<String1>.startsWith (<String2>) |
Boolean | Returns a value of true if the <String1> begins with the characters specified
in <String2>. |
|
| Ends with | |||
<String1>.endsWith
(<String2>) |
Boolean | Evaluates the contents of <String1> and returns a value of true if the String ends with
the characters specified in <String2>. |
|
| Contains | |||
<String1>.contains
(<String2>) |
Boolean | Evaluates the contents of <String1> and returns a value of true if it contains the exact
characters defined by <String2> |
|
| Equals | |||
<String1>.equals
(<String2>) |
Boolean | Returns a value of true if <String1> is the same as <String2>. |
|
| Index Of | |||
<String1>.indexOf
(<String2) |
Integer | Returns the beginning character position number of
<String2> within <String1>, if <String1> contains <String2>. If it does not, the function returns a value of
zero. |
|
| Replace String | |||
<String>.replaceString(stringToBeReplaced,replacementString) |
String | Returns a new String where the instances of the String to be replaced are replaced by the value of the replacement String. | |
| Regular expression replace String | |||
<String>.regexReplaceString(regularExpression,replacementString) |
String | Returns a new String where the Strings matching the regular expression are replaced by the replacement String. | |
| Matches | |||
<String>.matches(regularExpression:String) |
Boolean | Returns true if the regular expression matches the String. | |
| characterAt(index) | |||
<String>.characterAt(index:Integer) |
String | Returns the character at the specified position in the String. | |
| isInteger | |||
<String>.isInteger |
Boolean | Determines whether "this" String contains only integer
digits. Note: This operator examines each character in a string to
determine whether it is in the range 0 to 9. Therefore, the operator returns
true when the entire string evaluates
as a positive integer, and false when a
minus sign is the first character of a string that would evaluate as a
negative integer. A new extended operator could be created if the string as
a whole is to be evaluated as true whether
positive or negative (for example, by allowing the first character to be a
minus sign.) |
|
| trimSpaces | |||
<String>.trimSpaces |
String | Trims leading and trailing spaces from "this" String. | |