returns: the index of the first character occurrence after the offset.
Examples
Copy link to section
'hello mellow'.indexOf('ello', 2)
Copy to clipboardCopied to clipboard
Returns the integer 7.
lowerAscii
Copy link to section
Returns a new string with ASCII characters turned to lowercase.
Syntax
Copy link to section
(string).lowerAscii()
Copy to clipboardCopied to clipboard
returns: the new lowercase string.
Examples
Copy link to section
'TacoCat'.lowerAscii()
Copy to clipboardCopied to clipboard
Returns the string 'tacocat'.
replace
Copy link to section
Returns a new string based on the target, which replaces the occurrences of a search string with a replacement string if present. The function accepts an optional limit on the number of substring replacements to be made.
returns: the new string with occurrences of a search string replaced.
Examples
Copy link to section
'hello hello'.replace('he', 'we')
Copy to clipboardCopied to clipboard
Returns the string 'wello wello'.
split
Copy link to section
Returns a list of strings that are split from the input by the separator. The function accepts an optional argument that specifies a limit on the number of substrings that are produced by the split.
Syntax
Copy link to section
(string).split(separator (string), [limit (int)])
Copy to clipboardCopied to clipboard
returns: the split string as a string list.
Examples
Copy link to section
'hello hello hello'.split(' ')
Copy to clipboardCopied to clipboard
Returns the string list ['hello', 'hello', 'hello'].
substring
Copy link to section
Returns the substring given a numeric range corresponding to character positions. Optionally you might omit the trailing range for a substring from a character position until the end of a string.
Syntax
Copy link to section
(string).substring(start (int), [end (int)])
Copy to clipboardCopied to clipboard
returns: the substring at the specified index of the string.
Examples
Copy link to section
'tacocat'.substring(4)
Copy to clipboardCopied to clipboard
Returns the string 'cat'.
trim
Copy link to section
Returns a new string, which removes the leading and trailing white space in the target string. The trim function uses the Unicode definition of white space, which does not include the zero-width spaces.
Syntax
Copy link to section
(string).trim()
Copy to clipboardCopied to clipboard
returns: the new string with white spaces removed.
Examples
Copy link to section
' \ttrim\n '.trim()
Copy to clipboardCopied to clipboard
Returns the string 'trim'.
upperAscii
Copy link to section
Returns a new string where all ASCII characters are upper-cased.
Syntax
Copy link to section
(string).upperAscii()
Copy to clipboardCopied to clipboard
returns: the new string with all characters turned to uppercase.
Examples
Copy link to section
'TacoCat'.upperAscii()
Copy to clipboardCopied to clipboard
Returns the string 'TACOCAT'.
size
Copy link to section
Returns the length of the string, bytes, list, or map.
Syntax
Copy link to section
(string | bytes | list | map).size()
Copy to clipboardCopied to clipboard
returns: the length of the string, bytes, list, or map array.
Examples
Copy link to section
'hello'.size()
Copy to clipboardCopied to clipboard
Returns the integer 5.
'hello'.size()
Copy to clipboardCopied to clipboard
Returns the integer 5.
['a','b','c'].size()
Copy to clipboardCopied to clipboard
Returns the integer 3.
{'key': 'value'}.size()
Copy to clipboardCopied to clipboard
Returns the integer 1.
contains
Copy link to section
Tests whether the string operand contains the substring.
Syntax
Copy link to section
(string).contains(substring (string))
Copy to clipboardCopied to clipboard
returns: a Boolean value of whether the substring exists in the string operand.
Examples
Copy link to section
'hello'.contains('ll')
Copy to clipboardCopied to clipboard
Returns true.
endsWith
Copy link to section
Tests whether the string operand ends with the specified suffix.
Syntax
Copy link to section
(string).endsWith(suffix (string))
Copy to clipboardCopied to clipboard
returns: a Boolean value of whether the string ends with specified suffix in the string operand.
Examples
Copy link to section
'hello'.endsWith('llo')
Copy to clipboardCopied to clipboard
Returns true.
startsWith
Copy link to section
Tests whether the string operand starts with the prefix argument.
Syntax
Copy link to section
(string).startsWith(prefix (string))
Copy to clipboardCopied to clipboard
returns: a Boolean value of whether the string begins with specified prefix in the string operand.
Examples
Copy link to section
'hello'.startsWith('he')
Copy to clipboardCopied to clipboard
Returns true.
matches
Copy link to section
Tests whether the string operand matches regular expression.
Syntax
Copy link to section
(string).matches(prefix (string))
Copy to clipboardCopied to clipboard
returns: a Boolean value of whether the string matches the specified regular expression.
Examples
Copy link to section
'Hello'.matches('[Hh]ello')
Copy to clipboardCopied to clipboard
Returns true.
getDate
Copy link to section
Get the day of the month from the date with time zone (default Coordinated Universal Time), one-based indexing.
Syntax
Copy link to section
(timestamp).getDate([time_zone (string)])
Copy to clipboardCopied to clipboard
returns: the day of the month with one-based indexing.
About cookies on this siteOur websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising.For more information, please review your cookie preferences options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.