Functions - stringutils

contains

Checks whether the given string contains a particular substring.

equalsIgnoreCase

Checks if two strings are equal, ignoring the case of the strings.

hashCode

Returns a hash code for a given string.

lastIndexOf

Returns the last index of the provided substring within a string.

matches

Checks whether the given string matches with the provided regex.

replace

Replaces each substring of the provided string, that matches the provided substring, with the specified replacement string.

replaceAll

Replaces each substring which matches the given regular expression, from the given original string value, with the specified replacement string.

replaceFirst

Replaces the first substring that matches the given sequence from the provided string, with the specified literal replacement sequence.

split

Splits a string using the given delimiter.

toBoolean

Returns a boolean value of a given string.

contains

(string originalString, string substring)

returns boolean

Checks whether the given string contains a particular substring.

Parameters

  • originalString string
  • the original string

  • substring string
  • string to match

  • Return Type

    (boolean)
  • true if the original string contains the substring or false otherwise

equalsIgnoreCase

(string firstString, string secondString)

returns boolean

Checks if two strings are equal, ignoring the case of the strings.

Parameters

  • firstString string
  • first string to compare

  • secondString string
  • second string to compare

  • Return Type

    (boolean)
  • true if the two strings are the same or false if the strings do not match

hashCode

(string stringValue)

returns int

Returns a hash code for a given string.

Parameters

  • stringValue string
  • string to generate the hash code

  • Return Type

    (int)
  • hash code for the given string

lastIndexOf

(string originalString, string substring)

returns int

Returns the last index of the provided substring within a string.

Parameters

  • originalString string
  • the original string to search in

  • substring string
  • string to look for

  • Return Type

    (int)
  • starting point of the last appearance of the provided substring

matches

(string stringToMatch, string regex)

returns boolean

Checks whether the given string matches with the provided regex.

Parameters

  • stringToMatch string
  • string to match with the regex

  • regex string
  • regex to match with the string

  • Return Type

    (boolean)
  • true if the provided string is matched with the regex, false otherwise

replace

(string originalText, string textToReplace, string replacement)

returns string

Replaces each substring of the provided string, that matches the provided substring, with the specified replacement string.

Parameters

  • originalText string
  • original string

  • textToReplace string
  • string to replace

  • replacement string
  • replacement string

  • Return Type

    (string)
  • the resultant string

replaceAll

(string originalString, string regex, string replacement)

returns string

Replaces each substring which matches the given regular expression, from the given original string value, with the specified replacement string.

Parameters

  • originalString string
  • original string

  • regex string
  • Regex to find substrings to replace

  • replacement string
  • the replacement string

  • Return Type

    (string)
  • the resultant string

replaceFirst

(string originalString, string stringToReplace, string replacement)

returns string

Replaces the first substring that matches the given sequence from the provided string, with the specified literal replacement sequence.

Parameters

  • originalString string
  • the original string

  • stringToReplace string
  • string to replace

  • replacement string
  • the replacement string

  • Return Type

    (string)
  • the resultant string

split

(string receiver, string delimiter)

returns string

Splits a string using the given delimiter.

Parameters

  • receiver string
  • the original string

  • delimiter string
  • delimiter to split by

  • Return Type

    (string)
  • array of strings containing the split individual strings

toBoolean

(string stringValue)

returns boolean

Returns a boolean value of a given string.

Parameters

  • stringValue string
  • string value to convert to a boolean

  • Return Type

    (boolean)
  • true is the string is "true" (without considering the case), returns false otherwise