Skip to main content

String functions

leftTrim(string value)

  • This function takes in a string value and returns a string after removing all the whitespace characters from the left side of the string
def string value1 = leftTrim("   test string   "); // value1 = "test string   "
def string value2 = " test string ".leftTrim(); // value2 = "test string "

rightTrim(string value)

  • This function takes in a string value and returns a string after removing all the whitespace characters from the right side of the string
def string value = rightTrim("   test string   "); // value = "   test string"
def string value2 = " test string ".rightTrim(); // value2 = " test string"

trim(string value)

  • This function takes in a string value and returns a string after removing all the whitespace characters from both the sides of the string
def string value = trim("   test string   "); // value = "test string"
def string value2 = " test string ".trim(); // value2 = "test string"

isBlank(string value)

  • This function takes in a string value and returns a boolean indicating if the string is empty or only consists of whitespace characters
def boolean value1 = isBlank("   test string   "); // value = false
def boolean value2 = isBlank(""); // value = true
def boolean value3 = isBlank(" "); // value = true
def boolean value4 = " test string ".isBlank(); // value = false
def boolean value5 = "".isBlank(); // value = true
def boolean value6 = " ".isBlank(); // value = true

upperCase(string value)

  • This function takes in a string value and returns a string after all characters to upper case
def string value  = upperCase("test sRTiNg"); // value = "TEST STRING"
def string value2 = "test sRTiNg".upperCase(); // value2 = "TEST STRING"

lowerCase(string value)

  • This function takes in a string value and returns a string after all characters to lower case
def string value = lowerCase("test sRTiNg"); // value = "test string"
def string value2 = "test sRTiNg".lowerCase(); // value2 = "test string"

capitalize(string value)

  • This function takes in a string value and returns a string after converting the first letter to upper case and all the others to lower case
def string value = capitalize("test sRTiNg"); // value = "Test string"
def string value2 = "test sRTiNg".capitalize(); // value2 = "Test string"

properCase(string value)

  • This function takes in a string value and returns a string after converting the first letter of each word to upper case and all the others to lower case
def string value = properCase("test sRTiNg"); // value = "Test string"
def string value2 = "test sRTiNg".properCase(); // value2 = "Test string"

removeAll(string value, string valueToBeRemoved)

  • This function takes in two string value and returns a string after removing all occurrences of valueToBeRemoved from value
def string value = removeAll("This is his book.", "is"); // value = "Th  h book."
def string value2 = "This is his book.".removeAll("is"); // value2 = "Th h book."

removeFirst(string value, string valueToBeRemoved)

  • This function takes in two string value and returns a string after removing the first occurrence of valueToBeRemoved from value
def string value = removeFirst("This is his book.", "is"); // value = "Th is his book."
def string value2 = "This is his book.".removeFirst("is"); // value2 = "Th is his book."

removeLast(string value, string valueToBeRemoved)

  • This function takes in two string value and returns a string after removing the last occurrence of valueToBeRemoved from value
def string value = removeLast("This is his book.", "is"); // value = "This is h book."
def string value2 = "This is his book.".removeLast("is"); // value2 = "This is h book."

replaceAll(string value, string toBeReplaced, string replacementString)

  • This function takes in three string value and returns a string after replacing all occurrences of valueToBeRemoved in value with replacementString
def string value = replaceAll("This is his book.", "is", "are"); // value = "Thare are hare book."
def string value2 = "This is his book.".replaceAll("is", "are"); // value2 = "Thare are hare book."

replaceFirst(string value, string toBeReplaced, string replacementString)

  • This function takes in three string value and returns a string after replacing the first occurrence of valueToBeRemoved in value with replacementString
def string value = replaceFirst("This is his book.", "is", "are"); // value = "Thare is his book."
def string value2 = "This is his book.".replaceFirst("is", "are"); // value2 = "Thare is his book."

replaceLast(string value, string toBeReplaced, string replacementString)

  • This function takes in three string value and returns a string after replacing the last occurrence of valueToBeRemoved in value with replacementString
def string value = replaceLast("This is his book.", "is", "are"); // value = "This is hare book."
def string value2 = "This is his book.".replaceLast("is", "are"); // value2 = "This is hare book."

equalsIgnoreCase(string value, string secondValue)

  • This function takes in two string values and returns a boolean indicating whether they are equal ignoring case
  • You can use the not variant of this function as detailed here
def boolean value1 = equalsIgnoreCase("test", "TesT"); // value1 = true
def boolean value2 = equalsIgnoreCase("test", "T2esT"); // value2 = false
def boolean value3 = "test".equalsIgnoreCase("TesT"); // value3 = true
def boolean value4 = "test".equalsIgnoreCase("T2esT"); // value4 = false

contains(string value, string secondValue)

  • This function takes in two string values and returns a boolean indicating whether secondValue is present in value, without ignoring case
  • You can use the not variant of this function as detailed here
def boolean value1 = contains("Equilibrium", "quil"); // value1 = true
def boolean value2 = contains("Equilibrium", "Quil"); // value2 = false
def boolean value3 = contains("Equilibrium", "blah"); // value3 = false
def boolean value4 = "Equilibrium".contains("quil"); // value4 = true
def boolean value5 = "Equilibrium".contains("Quil"); // value5 = false
def boolean value6 = "Equilibrium".contains("blah"); // value6 = false

containsIgnoreCase(string value, string secondValue)

  • This function takes in two string values and returns a boolean indicating whether secondValue is present in value, ignoring case
  • You can use the not variant of this function as detailed here
def boolean value1 = containsIgnoreCase("Equilibrium", "quil"); // value1 = true
def boolean value2 = containsIgnoreCase("Equilibrium", "Quil"); // value2 = true
def boolean value3 = containsIgnoreCase("Equilibrium", "blah"); // value3 = false
def boolean value4 = "Equilibrium".containsIgnoreCase("quil"); // value4 = true
def boolean value5 = "Equilibrium".containsIgnoreCase("Quil"); // value5 = true
def boolean value6 = "Equilibrium".containsIgnoreCase("blah"); // value6 = false

isContainedIn(string value, string secondValue)

  • This function takes in two string values and returns a boolean indicating whether value is present in secondValue, without ignoring case
  • You can use the not variant of this function as detailed here
def boolean value1 = isContainedIn("quil", "Equilibrium"); // value1 = true
def boolean value2 = isContainedIn("Quil", "Equilibrium"); // value2 = false
def boolean value3 = isContainedIn("blah", "Equilibrium"); // value3 = false
def boolean value4 = "quil".isContainedIn("Equilibrium"); // value4 = true
def boolean value5 = "Quil".isContainedIn("Equilibrium"); // value5 = false
def boolean value6 = "blah".isContainedIn("Equilibrium"); // value6 = false

isContainedInIgnoreCase(string value, string secondValue)

  • This function takes in two string values and returns a boolean indicating whether value is present in secondValue, ignoring case
  • You can use the not variant of this function as detailed here
def boolean value = isContainedInIgnoreCase("quil", "Equilibrium"); // value = true
def boolean value2 = isContainedInIgnoreCase("Quil", "Equilibrium"); // value2 = true
def boolean value3 = isContainedInIgnoreCase("blah", "Equilibrium"); // value3 = false
def boolean value4 = "quil".isContainedInIgnoreCase("Equilibrium"); // value4 = true
def boolean value5 = "Quil".isContainedInIgnoreCase("Equilibrium"); // value5 = true
def boolean value6 = "blah".isContainedInIgnoreCase("Equilibrium"); // value6 = false

createFileFromText(string value)

  • This function takes in the content of a text file and returns a file object
def File value1 = createFileFromText("This is the content of the file"); // value1 = a file object
def File value2 = "This is the content of the file".createFileFromText(); // value2 = a file object

createImageFromBase64EncodedString(string value, string mimetype)

  • This function takes in the base64 encoded string of an image file and the mimetype, and returns an Image object
def Image value1 = createImageFromBase64EncodedString("Your Base64 encoded image", "image/jpeg"); // value1 = an image object
def Image value2 = "Your Base64 encoded image".createImageFromBase64EncodedString("image/jpeg"); // value2 = an image object

createAudioFromBase64EncodedString(string value, string mimetype)

  • This function takes in the base64 encoded string of an audio file and the mimetype, and returns an Audio object
def Audio value1 = createAudioFromBase64EncodedString("Your Base64 encoded audio", "audio/mp3"); // value1 = an audio object
def Audio value2 = "Your Base64 encoded audio".createAudioFromBase64EncodedString("audio/mp3"); // value2 = an audio object

startsWith(string value, string secondValue)

  • This function takes in two string values and returns a boolean indicating whether value starts with secondValue, without ignoring case
  • You can use the not variant of this function as detailed here
def boolean value1 = startsWith("Equilibrium", "Equi"); // value1 = true
def boolean value2 = startsWith("Equilibrium", "equi"); // value2 = false
def boolean value3 = startsWith("Equilibrium", "blah"); // value3 = false
def boolean value4 = "Equilibrium".startsWith("Equi"); // value4 = true
def boolean value5 = "Equilibrium".startsWith("equi"); // value5 = false
def boolean value6 = "Equilibrium".startsWith("blah"); // value6 = false

startsWithIgnoreCase(string value, string secondValue)

  • This function takes in two string values and returns a boolean indicating whether value starts with secondValue, ignoring case
  • You can use the not variant of this function as detailed here
def boolean value1 = startsWithIgnoreCase("Equilibrium", "Equi"); // value1 = true
def boolean value2 = startsWithIgnoreCase("Equilibrium", "equi"); // value2 = true
def boolean value3 = startsWithIgnoreCase("Equilibrium", "blah"); // value3 = false
def boolean value4 = "Equilibrium".startsWithIgnoreCase("Equi"); // value4 = true
def boolean value5 = "Equilibrium".startsWithIgnoreCase("equi"); // value5 = true
def boolean value6 = "Equilibrium".startsWithIgnoreCase("blah"); // value6 = false

endsWith(string value, string secondValue)

  • This function takes in two string values and returns a boolean indicating whether value ends with secondValue, without ignoring case
  • You can use the not variant of this function as detailed here
def boolean value1 = endsWith("Equilibrium", "rium"); // value1 = true
def boolean value2 = endsWith("Equilibrium", "Rium"); // value2 = false
def boolean value3 = endsWith("Equilibrium", "blah"); // value3 = false
def boolean value4 = "Equilibrium".endsWith("rium"); // value4 = true
def boolean value5 = "Equilibrium".endsWith("Rium"); // value5 = false
def boolean value6 = "Equilibrium".endsWith("blah"); // value6 = false

endsWithIgnoreCase(string value, string secondValue)

  • This function takes in two string values and returns a boolean indicating whether value ends with secondValue, ignoring case
  • You can use the not variant of this function as detailed here
def boolean value1 = endsWithIgnoreCase("Equilibrium", "rium"); // value1 = true
def boolean value2 = endsWithIgnoreCase("Equilibrium", "Rium"); // value2 = true
def boolean value3 = endsWithIgnoreCase("Equilibrium", "blah"); // value3 = false
def boolean value4 = "Equilibrium".endsWithIgnoreCase("rium"); // value4 = true
def boolean value5 = "Equilibrium".endsWithIgnoreCase("Rium"); // value5 = true
def boolean value6 = "Equilibrium".endsWithIgnoreCase("blah"); // value6 = false

reverse(string value)

  • This function takes in a string value and returns a string that is the reverse of it
def string value1 = reverse("Equilibrium"); // value1 = "muirbiliuqE"
def string value2 = reverse("This is a test"); // value2 = "tset a si siht"
def string value3 = "Equilibrium".reverse(); // value3 = "muirbiliuqE"
def string value4 = "This is a test".reverse(); // value4 = "tset a si siht"

substring(string value, int startingPosition, int endingPosition)

  • Returns a substring from beginIndex to endIndex (both inclusive)
def string value1 = substring("Hello world!", 7, 11); // value1 = "world"
def string value2 = "Hello world!".substring(7, 11); // value2 = "world"

split(string value, string separator)

  • Returns a List<string> after splitting value using separator
def List<string> value1 = split("This is his book.", "is"); // value1 = ["Th"," "," h"," book."]
def List<string> value2 = "This is his book.".split("is"); // value2 = ["Th"," "," h"," book."]
def List<string> value3 = "This is his book.".split(" "); // value3 = ["This","is","his","book."]
def List<string> value4 = split("This is his book.", " "); // value4 = ["This","is","his","book."]

stripNewLines(string value)

  • This function takes in a string value and returns a string after removing all newline characters ('\n', '\r') from it
def string value1 = stripNewLines("This is his book.\nGive it to him"); // value1 = "This is his book.Give it to him"
def string value2 = "This is his book.\nGive it to him".stripNewLines(); // value2 = "This is his book.Give it to him"

truncate(string value, int maxCharacters)

  • Returns a string after truncating it to given maximum number of characters
def string value1 = truncate("Hello world!", 5); // value = "Hello"
def string value2 = truncate("Hello world!", 20); // value = "Hello world!"
def string value3 = "Hello world!".truncate(5); // value = "Hello"
def string value4 = "Hello world!".truncate(20); // value = "Hello world!"

truncateWords(string value, int maxWords)

  • Returns a string after truncating it to given maximum number of words
def string value1 = truncateWords("This is his book", 3); // value1 = "This is his"
def string value2 = truncateWords("This is his book", 7); // value2 = "This is his book"
def string value3 = "This is his book".truncateWords(3); // value3 = "This is his"
def string value4 = "This is his book".truncateWords(7); // value4 = "This is his book"

getAlpha(string value)

  • Returns a string with after removing any non-alphabet characters present in it.
def string value1 = getAlpha("Hello 22 world!!"); // value1 = "Helloworld"
def string value2 = "Hello 22 world!!".getAlpha(); // value2 = "Helloworld"

getAlphaNumeric(string value)

  • Returns a string with after removing any non-alphanumeric characters present in it.
def string value1 = getAlphaNumeric("Hello 22 world!!"); // value1 = "Hello22world"
def string value2 = "Hello 22 world!!".getAlphaNumeric(); // value2 = "Hello22world"

getOccurrenceCount(string value, string substring)

  • Returns the number of times a substring is present in the given string.
def int value1 = getOccurrenceCount("This is his book", "is"); // value1 = 3
def int value2 = getOccurrenceCount("This is his book", "hello"); // value2 = 0
def int value3 = "This is his book".getOccurrenceCount("is"); // value3 = 3
def int value4 = "This is his book".getOccurrenceCount("hello"); // value4 = 0

removeAllAlpha(string value)

  • Returns a string with after removing any alphabet characters present in it.
def string value1 = removeAllAlpha("Hello 22 world!!"); // value1 = " 22 !!"
def string value2 = "Hello 22 world!!".removeAllAlpha(); // value2 = " 22 !!"

removeAllAlphaNumeric(string value)

  • Returns a string with after removing any alphanumeric characters present in it.
def string value1 = removeAllAlphaNumeric("Hello 22 world!!"); // value1 = "  !!"
def string value2 = "Hello 22 world!!".removeAllAlphaNumeric(); // value2 = " !!"

decodeURL(string value)

  • This function takes in a string value and returns a string after URL-decoding it
def string value1 = decodeURL("https%3A%2F%2Fwww.google.com"); // value1 = "https://www.google.com"
def string value2 = "https%3A%2F%2Fwww.google.com".decodeURL(); // value2 = "https://www.google.com"

encodeURL(string value)

  • This function takes in a string value and returns a string after URL-encoding it
def string value1 = encodeURL("https://www.google.com"); // value1 = "https%3A%2F%2Fwww.google.com"
def string value2 = "https://www.google.com".encodeURL(); // value2 = "https%3A%2F%2Fwww.google.com"
Consideration

Remember to always check whether the string is URL by using isURL() before calling this function otherwise you might get an error

getPrefix(string value, string substring)

  • Returns the string before the specified substring.
def string value1 = getPrefix("This is his book", "is"); // value1 = "Th"
def string value2 = "This is his book".getPrefix("is"); // value2 = "Th"

getSuffix(string value, string substring)

  • Returns the string after the specified substring.
def string value1 = getSuffix("This is his book", "is"); // value1 = " is his book"
def string value2 = "This is his book".getSuffix("is"); // value2 = " is his book"

indexOfSubstring(string value, string substring)

  • Returns the position of the first occurrence of the given substring in the string (first character's position is 1).
  • Returns 0 if the substring is not present
def int value1 = indexOfSubstring("This is his book", "is"); // value1 = 3
def int value2 = indexOfSubstring("This is his book", "Hello"); // value2 = 0
def int value3 = "This is his book".indexOfSubstring("is"); // value3 = 3
def int value4 = "This is his book".indexOfSubstring("Hello"); // value4 = 0

lastIndexOfSubstring(string value, string substring)

  • Returns the position of the last occurrence of the given substring in the string (first character's position is 1).
  • Returns 0 if the substring is not present
def int value1 = lastIndexOfSubstring("This is his book", "is"); // value1 = 10
def int value2 = lastIndexOfSubstring("This is his book", "Hello"); // value2 = 0
def int value3 = "This is his book".lastIndexOfSubstring("is"); // value3 = 10
def int value4 = "This is his book".lastIndexOfSubstring("Hello"); // value4 = 0

toInt(string value)

  • Converts the string to integer
def int value1 = toInt("23"); // value1 = 23
def int value2 = "23".toInt(); // value2 = 23
Consideration

Remember to always check whether the string is integer by using isInt() before calling this function otherwise you might get an error

toReal(string value, (optional) string decimalSeparator)

  • Converts the string to real number.
  • You can, optionally, pass a single width decimal separator
def real value1 = toReal("23.45"); // value1 = 23.45
def real value2 = toReal("23,45", ","); // value2 = 23.45
def real value3 = "23,45".toReal(","); // value3 = 23.45
Consideration

Remember to always check whether the string is real by using isReal() before calling this function otherwise you might get an error

Consideration

If decimalSeparator is passed, make sure that it is a single width string. Otherwise, an error will be thrown

toBoolean(string value)

  • Converts the string to boolean
def boolean value1 = toBoolean("true"); // value1 = true
def boolean value2 = "true".toBoolean(); // value2 = true
Consideration

Remember to always check whether the string is boolean before calling this function otherwise you might get an error

isInt(string value)

  • Returns a boolean indicating whether a string can be converted to integer
  • You can use the not variant of this function as detailed here
def boolean value1 = isInt("12"); // value1 = true
def boolean value2 = isInt("blah"); // value2 = false
def boolean value3 = "12".isInt(); // value3 = true
def boolean value4 = "blah".isInt(); // value4 = false

isReal(string value)

  • Returns a boolean indicating whether a string can be converted to real
  • You can use the not variant of this function as detailed here
def boolean value1 = isReal("-12.45"); // value1 = true
def boolean value2 = isReal("blah"); // value2 = false
def boolean value3 = "-12.45".isReal(); // value3 = true
def boolean value4 = "blah".isReal(); // value4 = false

decodeFromBase64(string value)

  • Returns a base64-decoded string
def string value1 = decodeFromBase64("dGVzdA=="); // value1 = "test"
def string value2 = "dGVzdA==".decodeFromBase64(); // value2 = "test"
Consideration

Make sure you have properly base64 encode string before calling this function otherwise you might get an error

encodeAsBase64(string value)

  • Returns a base64-encoded string
def string value1 = encodeAsBase64("test"); // value1 = "dGVzdA=="
def string value2 = "test".encodeAsBase64(); // value2 = "dGVzdA=="

isURL(string value)

  • Returns whether a string is a valid URL
  • You can use the not variant of this function as detailed here
def boolean value1 = isURL("https://www.google.com"); // value1 = true
def boolean value2 = isURL("blah"); // value2 = false
def boolean value3 = "https://www.google.com".isURL(); // value3 = true
def boolean value4 = "blah".isURL(); // value4 = false

toDate(string value,(Optional) string format, (Optional) string timezone)

  • Converts a string to Date
  • If the format is not provided, default format (yyyy-MM-dd) is used
  • Valid value for the timezone are TZ Identifier Column in the list
def Date value1 = toDate("2018-12-23");
def Date value2 = toDate("23/12/2018", "dd/MM/yyyy");
def Date value3 = toDate("23/12/2018", "dd/MM/yyyy", "America/Los_Angeles");
def Date value4 = "23/12/2018".toDate("dd/MM/yyyy", "America/Los_Angeles");
Consideration

Remember to always check whether the string is Date by using isDate() before calling this function otherwise you might get an error

toTime(string value,(Optional) string format)

  • Converts a string to Time
  • If the format is not provided, default format (HH:mm:ss.nnn) is used
def Time value1 = toTime("21:30:20");
def Time value2 = toTime("21:30", "HH:mm");
def Time value3 = "21:30:20".toTime("HH:mm");
def Time value4 = "21:30".toTime();
Consideration

Remember to always check whether the string is Time by using isTime() before calling this function otherwise you might get an error

toDateTime(string value,(Optional) string format, (Optional) string timezone)

  • Converts a string to DateTime
  • If the format is not provided, default format (yyyy-MM-ddTHH:mm:ss.nnn) is used
  • Valid value for the timezone are TZ Identifier Column in the list
def DateTime value1 = toDateTime("2018-12-23T21:30:20");
def DateTime value2 = toDateTime("23/12/2018 21:30", "dd/MM/yyyy HH:mm");
def DateTime value3 = toDateTime("23/12/2018 21:30", "dd/MM/yyyy HH:mm", "America/Los_Angeles");
def DateTime value4 = "23/12/2018 21:30".toDateTime("dd/MM/yyyy HH:mm", "America/Los_Angeles");
Consideration

Remember to always check whether the string is DateTime by using isDateTime() before calling this function otherwise you might get an error

toOffsetDateTime(string value, string format)

  • Converts a string to DateTime
  • This is same as toDateTime but should be used if your string contains timezone information
def DateTime value1 = toOffsetDateTime("23/12/2018 21:30+0530", "dd/MM/yyyy HH:mmXXX");
def DateTime value2 = "23/12/2018 21:30+0530".toOffsetDateTime("dd/MM/yyyy HH:mmXXX");

isDate(string value,(Optional) string format)

  • Returns whether a string is Date
  • If the format is not provided, default format (yyyy-MM-dd) is used
  • You can use the not variant of this function as detailed here
def boolean value1 = isDate("2018-12-23"); // true
def boolean value2 = isDate("23/12/2018", "dd/MM/yyyy"); // true
def boolean value3 = isDate("23/12/2018"); // false
def boolean value4 = "2018-12-23".isDate(); // true
def boolean value5 = "23/12/2018".isDate("dd/MM/yyyy"); // true
def boolean value6 = "23/12/2018".isDate(); // false

isTime(string value,(Optional) string format)

  • Returns whether a string is Time
  • If the format is not provided, default format (HH:mm:ss.nnn) is used
  • You can use the not variant of this function as detailed here
def boolean value1 = isTime("21:30:20"); // true
def boolean value2 = isTime("21:30", "HH:mm"); // true
def boolean value3 = isTime("21 30"); // false
def boolean value4 = "21:30:20".isTime(); // true
def boolean value5 = "21:30".isTime("HH:mm"); // true
def boolean value6 = "21 30".isTime(); // false

isDateTime(string value,(Optional) string format)

  • Returns whether a string is DateTime
  • If the format is not provided, default format (yyyy-MM-ddTHH:mm:ss.nnn) is used
  • You can use the not variant of this function as detailed here
def boolean value1 = isDateTime("2018-12-23T21:30:20"); // true
def boolean value2 = isDateTime("23/12/2018 21:30", "dd/MM/yyyy HH:mm"); // true
def boolean value3 = isDateTime("23/12/2018 21:30"); // false
def boolean value4 = "2018-12-23T21:30:20".isDateTime(); // true
def boolean value5 = "23/12/2018 21:30".isDateTime("dd/MM/yyyy HH:mm"); // true
def boolean value6 = "23/12/2018 21:30".isDateTime(); // false

regexMatch(string value, string regex)

  • Returns a boolean indicating whether a string matches a given regex
  • You can use the not variant of this function as detailed here
def boolean value1  = regexMatch("True", "[tT]rue"); // true
def boolean value2 = regexMatch("true", "[tT]rue"); // true
def boolean value3 = regexMatch("TRUE", "[tT]rue"); // false
def boolean value4 = "True".regexMatch("[tT]rue"); // true
def boolean value5 = "true".regexMatch("[tT]rue"); // true
def boolean value6 = "TRUE".regexMatch("[tT]rue"); // false

regexReplace(string value, string regex, string replacementString)

  • Returns the string with all matching instances of regex replaced with the given replacementString
def string value1 = regexReplace("This IS hIs book", "[iI][sS]", "yay"); // Thyay yay hyay book
def string value2 = "This IS hIs book".regexReplace("[iI][sS]", "yay"); // Thyay yay hyay book

stripASCII(string value)

  • Removes all non-ASCII characters from the value
def string value1 = stripASCII("Resåß∂ƒ©ult"); // Result
def string value2 = "Resåß∂ƒ©ult".stripASCII(); // Result

removeDiacritics(string value)

  • Removes all diacritics from the value and converts it to its base character
def string value1 = removeDiacritics("Tĥïŝ ĩš â fůňķŷ Šťŕĭńġ"); // This is a funky String
def string value2 = "Tĥïŝ ĩš â fůňķŷ Šťŕĭńġ".removeDiacritics(); // This is a funky String

removeHTML(string value)

  • Use this to remove HTML tags
def string value1 = removeHTML("<div>lol</div> something <div></div> test"); // lol something test
def string value2 = "<div>lol</div> something <div></div> test".removeHTML(); // lol something test

md5(string value)

  • Use this to calculate MD5 checksum of a string
def string value1 = md5("This is a test"); // 41fb5b5ae4d57c5ee528adb00e5e8e74
def string value2 = "This is a test".md5(); // 41fb5b5ae4d57c5ee528adb00e5e8e74

sha1(string value)

  • Use this to calculate SHA-1 value of a string
def string value1 = sha1("This is a test"); // f72017485fbf6423499baf9b240daa14f5f095a1
def string value2 = "This is a test".sha1(); // f72017485fbf6423499baf9b240daa14f5f095a1

sha256(string value)

  • Use this to calculate SHA-256 value of a string
def string value1 = sha256("This is a test"); // 4e9518575422c9087396887ce20477ab5f550a4aa3d161c5c22a996b0abb8b35
def string value2 = "This is a test".sha256(); // 4e9518575422c9087396887ce20477ab5f550a4aa3d161c5c22a996b0abb8b35

sha512(string value)

  • Use this to calculate SHA-512 value of a string
def string value1 = sha512("This is a test"); // f4d54d32e3523357ff023903eaba2721e8c8cfc7702663782cb3e52faf2c56c002cc3096b5f2b6df870be665d0040e9963590eb02d03d166e52999cd1c430db1
def string value2 = "This is a test".sha512(); // f4d54d32e3523357ff023903eaba2721e8c8cfc7702663782cb3e52faf2c56c002cc3096b5f2b6df870be665d0040e9963590eb02d03d166e52999cd1c430db1

pluralize(string value)

  • Use this to convert a noun from its singular form to plural form
def string value1 = pluralize("calf"); // calves
def string value2 = "calf".pluralize(); // calves

wordCount(string value)

  • Counts the number of words in a string
def int value1 = wordCount("\"This isn't a crime-fighting dog\", said the inspector."); // 8
def int value2 = "\"This isn't a crime-fighting dog\", said the inspector.".wordCount(); // 8

extractEmailAddress(string value)

  • Extract all email addresses from a given string
  • Returns empty if nothing is found
def List<string> result1 = extractEmailAddress("My emails are test1@example.com and test2@example.com."); // ["test1@example.com", "test2@example.com"]
def List<string> result2 = "My emails are test1@example.com and test2@example.com.".extractEmailAddress(); // ["test1@example.com", "test2@example.com"]

extractPhoneNumber(string value, (Optional) string countryCode)

  • Extract all phone numbers from a given string
  • Returns empty if nothing is found
  • An optional country code can be passed, if you are only interested in the phone numbers from a particular country
def List<string> result1 = extractPhoneNumber("My phone numbers are +919876543210 and +911234567890"); // ["+919876543210", "+911234567890"]
def List<string> result2 = "My phone numbers are +919876543210 and +911234567890".extractPhoneNumber(); // ["+919876543210", "+911234567890"]

extractRegex(string value, string regex, (Optional) string regexFlags)

  • Extract all strings matching the given regex from a given string
  • Returns empty if nothing is found
  • Optional regex flags can be passed
    • i - Case-insensitive
    • m - Multiline
    • s - DotAll
def List<string> result1 = extractRegex("The numbers are 4, 8 and 7", "\\d"); // ["4","8", "7"]
def List<string> result2 = "The numbers are 4, 8 and 7".extractRegex("\\d"); // ["4","8", "7"]

extractReal(string value)

  • Extract all floating-point numbers from a given string
  • Returns empty if nothing is found
def List<string> result1 = extractReal("The readings are 12.34 and 15.68"); // ["12.34", "15.68"]
def List<string> result2 = "The readings are 12.34 and 15.68".extractReal(); // ["12.34", "15.68"]

extractInteger(string value)

  • Extract all integers from a given string
  • Returns empty if nothing is found
def List<string> result1 = extractInteger("The numbers are 4, 8, 15, 16, 23 and 42"); // ["4","8","15","16","23","42"]
def List<string> result2 = "The numbers are 4, 8, 15, 16, 23 and 42".extractInteger(); // ["4","8","15","16","23","42"]

extractURL(string value)

  • Extract all URLs from a given string
  • Returns empty if nothing is found
def List<string> result1 = extractURL("https://www.google.com and https://fb.com are my favourite websites"); // ["https://google.com", "https://fb.com"]
def List<string> result2 = "https://www.google.com and https://fb.com are my favourite websites".extractURL(); // ["https://google.com", "https://fb.com"]

convertHTMLToMarkdown(string value)

  • Convert a HTML string into its equivalent Markdown format
def string htmlString = "<h1>Some title</h1><div>Some html<p>Another paragraph</p></div>"
def string result1 = convertHTMLToMarkdown(htmlString);
def string result2 = htmlString.convertHTMLToMarkdown();
/*
Some title
==========

Some html

Another paragraph

*/

convertMarkdownToHTML(string value)

  • Convert a Markdown string into its equivalent HTML format
def string mdString = "# Heading h1\n"
+ "## Heading h2\n"
+ "### Heading h3\n"
+ "#### Heading h4\n"
+ "---";
def string result1 = convertMarkdownToHTML(mdString);
def string result2 = mdString.convertMarkdownToHTML();
/*
<h1>Heading h1</h1>
<h2>Heading h2</h2>
<h3>Heading h3</h3>
<h4>Heading h4</h4>
<hr />
*/

formatPhoneNumber(string phoneNumber, string format, string locale, boolean isValidated)

  • Formats phone number in a given format and locale
  • If isValidated is passed and the phone number is an invalid number, then null is returned
  • Options for format
    • E164
    • INTERNATIONAL
    • NATIONAL
    • RFC3966
def string phoneNumber = "+919876543210";
def string result1 = formatPhoneNumber(phoneNumber,"INTERNATIONAL", "IN", false); // +91 98765 43210
def string result2 = phoneNumber.formatPhoneNumber("INTERNATIONAL", "IN", false); // +91 98765 43210

uuid()

  • Generate a type 4 (pseudo randomly generated) UUID. The UUID is generated using a cryptographically strong pseudo random number generator
def string result1 = uuid(); // f80a2b16-b407-4ecd-83a6-35ce8556cf45
def string result2 = uuid(); // f80a2b16-b407-4ecd-83a6-35ce8556cf45

centrePad(string value, int size, (Optional) separator)

  • Returns a string of the specified size padded with the specified string on the left and right, so that it appears in the center. If the specified size is smaller than the string size, the entire string is returned without padding.
  • If the separator is not specified, a single whitespace character(" ") is used as the separator
def string text = "Test";
def string result1 = text.centrePad(10); // " Test "
def string result2 = text.centrePad(10, "-"); // "---Test---"
def string result3 = centrePad(text, 10); // " Test "
def string result4 = centrePad(text, 10, "-"); ; // "---Test---"

containsAny(string value, string substring)

  • Returns true if the string contains any of the characters in the specified substring; otherwise, returns false.
  • You can use the not variant of this function as detailed here
def string s = "hello";
def boolean b1 = s.containsAny("hx"); // true
def boolean b2 = s.containsAny("x"); // false
def boolean b3 = containsAny(s, "hx"); // true
def boolean b4 = containsAny(s, "x"); // false

containsNone(string value, string substring)

  • Returns true if the string doesn’t contain any of the characters in the specified substring; otherwise, returns false.
  • You can use the not variant of this function as detailed here
def string s = "abcde";
def boolean b1 = s.containsNone("fg"); // true
def boolean b2 = s.containsNone("c"); // false
def boolean b3 = containsNone(s, "fg"); // true
def boolean b4 = containsNone(s, "c"); // false

containsOnly(string value, string substring)

  • Returns true if the string contains characters only from the specified substring and not any other characters; otherwise, returns false.
  • You can use the not variant of this function as detailed here
def string s = "abba";
def boolean b1 = s.containsOnly("ab"); // true
def boolean b2 = s.containsOnly("ac"); // false
def boolean b3 = containsOnly(s, "ab"); // true
def boolean b4 = containsOnly(s, "ac"); // false

containsWhitespace(string value)

  • Returns true if the string contains any white space characters; otherwise, returns false.
  • You can use the not variant of this function as detailed here
def boolean b1 = "ab ba".containsWhitespace(); // true
def boolean b2 = "abba".containsWhitespace(); // false
def boolean b3 = containsWhitespace("ab ba"); // true
def boolean b4 = containsWhitespace("abba"); // false

removeAllWhitespace(string value)

  • Returns a version of the string with all white space characters removed.
def string s1 = "ab ba".removeAllWhitespace(); // "abba"
def string s2 = removeAllWhitespace("ab ba"); // "abba"

differenceOfString(string value1, string value2)

  • Returns the difference between the two strings.
def string s1 = "Hello Jane".differenceOfString("Hello Max"); // "Max"
def string s2 = differenceOfString("Hello Jane", "Hello Max"); // "Max"

escapeCsv(string value)

  • Returns a string for a CSV column enclosed in double quotes, if required.
def string s1 = "Max1, Max2".escapeCsv(); // "\"Max1, Max2\""
def string s2 = escapeCsv("Max1, Max2"); // "\"Max1, Max2\""

escapeEcmaScript(string value)

  • Escapes the characters in the string using EcmaScript string rules.
def string s1 = "{\"x\": 1 / 4}".escapeEcmaScript(); // "{\"x\": 1 \/ 4}"
def string s2 = escapeEcmaScript("{\"x\": 1 / 4}"); // "{\"x\": 1 \/ 4}"

escapeHtml3(string value)

  • Escapes the characters in a string using HTML 3.0 entities.
def string s1 = "<Black&White>".escapeHtml3(); // "&lt;Black&amp;White&gt;"
def string s2 = escapeHtml3("<Black&White>"); // "&lt;Black&amp;White&gt;"

escapeHtml4(string value)

  • Escapes the characters in a string using HTML 4.0 entities.
def string s1 = "<Black&White>".escapeHtml4(); // "&lt;Black&amp;White&gt;"
def string s2 = escapeHtml4("<Black&White>"); // "&lt;Black&amp;White&gt;"

escapeJava(string value)

  • Returns a string whose characters are escaped using Java string rules.
def string s1 = "Company: \"Askribe.com\"".escapeJava(); // "Company: \"Askribe.com\""
def string s2 = escapeJava("Company: \"Askribe.com\""); // "Company: \"Askribe.com\""

escapeSingleQuotes(string value)

  • Returns a string with the escape character (\) added before any single quotation marks in the string.
def string s1 = "jim's guitar".escapeSingleQuotes(); // "jim\'s guitar"
def string s2 = escapeSingleQuotes("jim's guitar"); // "jim\'s guitar"

escapeUnicode(string value)

  • Returns a string whose Unicode characters are escaped to a Unicode escape sequence.
def string s1 = "De onde você é?".escapeUnicode(); // "De onde voc\\u00EA \\u00E9?"
def string s2 = escapeUnicode("De onde você é?"); // "De onde voc\\u00EA \\u00E9?"

escapeXml(string value)

  • Escapes the characters in a string using XML entities.
def string s1 = "<Black&White>".escapeXml(); // "&lt;Black&amp;White&gt;"
def string s2 = escapeXml("<Black&White>"); // "&lt;Black&amp;White&gt;"

getCommonStringPrefix(List<string> values)

  • Returns the initial sequence of characters as a string that is common to all the specified strings.
  • The list should not be empty
def string value1 = getCommonStringPrefix(["This is his book", "This is his car", "This"]); // "This"
def string value2 = getCommonStringPrefix(["This is his book", "This is his car", "This", "t"]); // ""
def string value3 = ["This is his book", "This is his car", "This"].getCommonStringPrefix(); // "This"
def string value4 = ["This is his book", "This is his car", "This", "t"].getCommonStringPrefix(); // ""

getLevenshteinDistance(string value1, string value2)

  • Returns the Levenshtein distance between two strings
def int value1 = "This is his book".getLevenshteinDistance("This is his car"); // value = 4
def int value2 = "This is his book".getLevenshteinDistance("Hello"); // value = 15
def int value3 = getLevenshteinDistance("This is his book", "This is his car"); // value = 4
def int value4 = getLevenshteinDistance("This is his book", "Hello"); // value = 15

indexOfStringDifference(string value, string value2)

  • Returns the index of the character where the first string begins to differ from the second string.
def int value1 = "This is his book".indexOfStringDifference("This is his car"); // value = 13
def int value2 = "This is his book".indexOfStringDifference("Hello"); // value = 1
def int value3 = indexOfStringDifference("This is his book", "This is his car"); // value = 13
def int value4 = indexOfStringDifference("This is his book", "Hello"); // value = 10

indexOfSubstringIgnoreCase(string value, string substring)

  • Returns the index of the first occurrence of the specified substring without regard to case. If the substring does not occur, this method returns 0.
def int value1 = "This is his book".indexOfSubstringIgnoreCase("IS"); // value = 3
def int value2 = "This is his book".indexOfSubstringIgnoreCase("Hello"); // value = 0
def int value3 = indexOfSubstringIgnoreCase("This is his book", "IS"); // value = 3
def int value4 = indexOfSubstringIgnoreCase("This is his book", "Hello"); // value = 0

isAllLowerCase(string value)

  • Returns true if all characters in the string are lowercase; otherwise, returns false.
  • You can use the not variant of this function as detailed here
def boolean b1 = "abba".isAllLowerCase(); // true
def boolean b2 = "tesT".isAllLowerCase(); // false
def boolean b3 = isAllLowerCase("abba"); // true
def boolean b4 = isAllLowerCase("tesT"); // false

isAllUpperCase(string value)

  • Returns true if all characters in the string are uppercase; otherwise, returns false.
  • You can use the not variant of this function as detailed here
def boolean b1 = "ABBA".isAllUpperCase(); // true
def boolean b2 = "xYz".isAllUpperCase(); // false
def boolean b3 = isAllUpperCase("ABBA"); // true
def boolean b4 = isAllUpperCase("xYz"); // false

isAlpha(string value)

  • Returns true if all characters in the string are Unicode letters only; otherwise, returns false.
  • You can use the not variant of this function as detailed here
def boolean b1 = "abba".isAlpha(); // true
def boolean b2 = "x2z".isAlpha(); // false
def boolean b3 = isAlpha("abba"); // true
def boolean b4 = isAlpha("x2z"); // false

isAlphaSpace(string value)

  • Returns true if all characters in the string are Unicode letters or spaces only; otherwise, returns false.
  • You can use the not variant of this function as detailed here
def boolean b1 = "ab ba".isAlphaSpace(); // true
def boolean b2 = "x 2z".isAlphaSpace(); // false
def boolean b3 = isAlphaSpace("ab ba"); // true
def boolean b4 = isAlphaSpace("x 2z"); // false

isAlphanumeric(string value)

  • Returns true if all characters in the string are Unicode letters or numbers only; otherwise, returns false.
  • You can use the not variant of this function as detailed here
def boolean b1 = "abba12".isAlphanumeric(); // true
def boolean b2 = "x yz12".isAlphanumeric(); // false
def boolean b3 = isAlphanumeric("abba12"); // true
def boolean b4 = isAlphanumeric("x yz12"); // false

isAlphanumericSpace(string value)

  • Returns true if all characters in the string are Unicode letters, numbers, or spaces only; otherwise, returns false.
  • You can use the not variant of this function as detailed here
def boolean b1 = "ab ba12".isAlphanumericSpace(); // true
def boolean b2 = "xy,;".isAlphanumericSpace(); // false
def boolean b3 = isAlphanumericSpace("ab ba12"); // true
def boolean b4 = isAlphanumericSpace("xy,;"); // false

isNumeric(string value)

  • Returns true if the string contains only Unicode digits; otherwise, returns false.
  • Note that decimal point (.) is NOT a unicode digit
  • You can use the not variant of this function as detailed here
def boolean b1 = "1234".isNumeric(); // true
def boolean b2 = "xyz".isNumeric(); // false
def boolean b3 = isNumeric("1234"); // true
def boolean b4 = isNumeric("xyz"); // false

isNumericSpace(string value)

  • Returns true if the string contains only Unicode digits or spaces; otherwise, returns false.
  • You can use the not variant of this function as detailed here
def boolean b1 = "12 34".isNumericSpace(); // true
def boolean b2 = "xyz".isNumericSpace(); // false
def boolean b3 = isNumericSpace("12 34"); // true
def boolean b4 = isNumericSpace("xyz"); // false

isWhitespace(string value)

  • Returns true if the string contains only white space characters or is empty; otherwise, returns false.
  • You can use the not variant of this function as detailed here
def boolean b1 = "    ".isWhitespace(); // true
def boolean b2 = " x ".isWhitespace(); // false
def boolean b3 = isWhitespace(" "); // true
def boolean b4 = isWhitespace(" x "); // false

lastIndexOfSubstringIgnoreCase(string value, string substring)

  • Returns the index of the last occurrence of the specified substring without regard to case. If the substring does not occur, this method returns 0.
def int value1 = "This is his book".lastIndexOfSubstringIgnoreCase("IS"); // value = 10
def int value2 = "This is his book".lastIndexOfSubstringIgnoreCase("Hello"); // value = 0
def int value3 = lastIndexOfSubstringIgnoreCase("This is his book", "IS"); // value = 10
def int value4 = lastIndexOfSubstringIgnoreCase("This is his book", "Hello"); // value = 0

leftString(string value, int length)

  • Returns the leftmost characters of the string of the specified length.
def string text = "This IS hIs book";
def string result1 = text.leftString(3); // Thi
def string result2 = leftString(text, 3); // Thi

leftPad(string value, int length, (Optional) string separator)

  • Returns the string padded with string separator on the left and of the specified length.
  • If no separator is specified, single whitespace character (" ") is used as the separator
def string text = "Test";
def string result1 = text.leftPad(10); // " Test"
def string result2 = text.leftPad(10, "-"); // "------Test"
def string result3 = leftPad(text, 10); // " Test"
def string result4 = leftPad(text, 10, "-"); ; // "------Test"

midString(string value, int startIndex, int length)

  • Returns a new string that begins with the character at the specified startIndex with the number of characters specified by length.
def string text = "This IS hIs book";
def string result1 = text.midString(3, 5); // is IS
def string result2 = midString(text, 3, 5); // is IS

normalizeSpace(string value)

  • Returns the string with leading, trailing, and repeating white space characters removed.
def string text = "   This       is his book ";
def string result1 = text.normalizeSpace("BOOK"); // "This is his book"
def string result2 = normalizeSpace(text, "BOOK"); // "This is his book"

removeEnd(string value, string substring)

  • Removes the specified substring only if it occurs at the end of the string.
def string text = "This is his book";
def string result1 = text.removeEnd("book"); // "This is his "
def string result2 = text.removeEnd("boo"); // "This is his book"
def string result3 = removeEnd(text, "book"); // "This is his "
def string result4 = removeEnd(text, "boo"); ; // "This is his book"

removeEndIgnoreCase(string value, string substring)

  • Removes the specified substring only if it occurs at the end of the string using a case-insensitive match.
def string text = "This is his book";
def string result1 = text.removeEndIgnoreCase("BOOK"); // "This is his "
def string result2 = text.removeEndIgnoreCase("BOO"); // "This is his book"
def string result3 = removeEndIgnoreCase(text, "BOOK"); // "This is his "
def string result4 = removeEndIgnoreCase(text, "BOO"); ; // "This is his book"

removeStart(string value, string substring)

  • Removes the specified substring only if it occurs at the beginning of the string.
def string text = "This is his book";
def string result1 = text.removeStart("This"); // " is his book"
def string result2 = text.removeStart("his"); // "This is his book"
def string result3 = removeStart(text, "This"); // " is his book"
def string result4 = removeStart(text, "his"); ; // "This is his book"

removeStartIgnoreCase(string value, string substring)

  • Removes the specified substring only if it occurs at the beginning of the string using a case-insensitive match.
def string text = "This is his book";
def string result1 = text.removeStartIgnoreCase("THIS"); // " is his book"
def string result2 = text.removeStartIgnoreCase("HIS"); // "This is his book"
def string result3 = removeStartIgnoreCase(text, "THIS"); // " is his book"
def string result4 = removeStartIgnoreCase(text, "HIS"); ; // "This is his book"

repeatString(string value, int numberOfTimes, (Optional) string separator)

  • Returns the string repeated the specified number of times using the specified separator to separate the repeated Strings.
  • If no separator is specified, empty character ("") is used as the separator
def string text = "Cool";
def string result1 = text.repeatString(3); // "CoolCoolCool"
def string result2 = text.repeatString(3, "!"); // "Cool!Cool!Cool"
def string result3 = repeatString(text, 3); // "CoolCoolCool"
def string result4 = repeatString(text, 3, "!"); // "Cool!Cool!Cool"

rightString(string value, int length)

  • Returns the rightmost characters of the string of the specified length.
def string text = "This IS hIs book";
def string result1 = text.rightString(3); // ook
def string result2 = rightString(text, 3); // ook

rightPad(string value, int length, (Optional) string separator)

  • Returns the string padded with string separator on the right and of the specified length.
  • If no separator is specified, single whitespace character (" ") is used as the separator
def string text = "Test";
def string result1 = text.rightPad(10); // "Test "
def string result2 = text.rightPad(10, "-"); // "Test------"
def string result3 = rightPad(text, 10); // "Test "
def string result4 = rightPad(text, 10, "-"); ; // "Test------"

splitRegex(string value, string regex)

  • Split a string using the given the regex
def string text = "This IS hIs book";
def List<string> result1 = text.splitRegex("[iI][sS]"); // ["Th"," "," h"," book"]
def List<string> result2 = splitRegex(text, "[iI][sS]"); // ["Th"," "," h"," book"]

splitByCharacterType(string value)

  • Splits the string by character type and returns a list of contiguous character groups of the same type as complete tokens.
def string text = "Cool.Awesome.Platform";
def List<string> result1 = text.splitByCharacterType(); // ["C","ool",".","A","wesome",".","P","latform"]
def List<string> result2 = splitByCharacterType(text); // ["C","ool",".","A","wesome",".","P","latform"]

splitByCharacterTypeCamelCase(string value)

  • Splits the string by character type and returns a list of contiguous character groups of the same type as complete tokens, with the following exception: the uppercase character, if any, immediately preceding a lowercase character token belongs to the following character token rather than to the preceding.
def string text = "Cool.Awesome.Platform";
def List<string> result1 = text.splitByCharacterTypeCamelCase(); // ["Cool",".","Awesome",".","Platform"]
def List<string> result2 = splitByCharacterTypeCamelCase(text); // ["Cool",".","Awesome",".","Platform"]

substringAfter(string value, string substring)

  • Returns the substring that occurs after the first occurrence of the specified substring.
def string text = "Cool.Awesome.Platform";
def string result1 = text.substringAfter("."); // Awesome.Platform
def string result2 = substringAfter(text, "."); // Awesome.Platform

substringAfterLast(string value, string substring)

  • Returns the substring that occurs after the last occurrence of the specified substring.
def string text = "Cool.Awesome.Platform";
def string result1 = text.substringAfterLast("."); // Platform
def string result2 = substringAfterLast(text, "."); // Platform

substringBefore(string value, string substring)

  • Returns the substring that occurs before the first occurrence of the specified substring.
def string text = "Cool.Awesome.Platform";
def string result1 = text.substringBefore("."); // Cool
def string result2 = substringBefore(text, "."); // Cool

substringBeforeLast(string value, string substring)

  • Returns the substring that occurs before the last occurrence of the specified substring.
def string text = "Cool.Awesome.Platform";
def string result1 = text.substringBeforeLast("."); // Cool.Awesome
def string result2 = substringBeforeLast(text, "."); // Cool.Awesome

substringBetweenString(string value, string substring)

  • Returns the substring that occurs between two instances of the specified substring.
def string text = "Cool.Awesome.Platform";
def string result1 = text.substringBetweenString("."); // Awesome
def string result2 = substringBetweenString(text, "."); // Awesome

substringBetweenStrings(string value, string leftString, string rightString)

  • Returns the substring that occurs between the two specified Strings.
def string text = "Cool.Awesome.Platform";
def string result1 = text.substringBetweenStrings("Cool.", ".Platform"); // Awesome
def string result2 = substringBetweenStrings(text, "Cool.", ".Platform"); // Awesome

swapCase(string value)

  • Swaps the case of all characters and returns the resulting string
def string text = "Test";
def string result1 = text.swapCase(); // "tEST"
def string result2 = swapCase(text); // "tEST"

uncapitalize(string value)

  • Returns the string with the first letter in lowercase.
def string text = "Test";
def string result1 = text.uncapitalize(); // "test"
def string result2 = uncapitalize(text); // "test"

unescapeCsv(string value)

  • Returns a string representing an unescaped CSV column.
def string s1 = "\"Max1, Max2\"".unescapeCsv(); // "Max1, Max2"
def string s2 = unescapeCsv("\"Max1, Max2\""); // "Max1, Max2"

unescapeEcmaScript(string value)

  • Unescapes any EcmaScript literals found in the string.
def string s1 = "{\"x\": 1 \/ 4}".unescapeEcmaScript(); // {"x": 1 / 4}
def string s2 = unescapeEcmaScript("{\"x\": 1 \/ 4}"); // {"x": 1 / 4}

unescapeHtml3(string value)

  • Unescapes the characters in a string using HTML 3.0 entities.
def string s1 = "&lt;Black&amp;White&gt;".unescapeHtml3(); // <Black&White>
def string s2 = unescapeHtml3("&lt;Black&amp;White&gt;"); // <Black&White>

unescapeHtml4(string value)

  • Unescapes the characters in a string using HTML 4.0 entities.
def string s1 = "&lt;Black&amp;White&gt;".unescapeHtml4(); // <Black&White>
def string s2 = unescapeHtml4("&lt;Black&amp;White&gt;"); // <Black&White>

unescapeJava(string value)

  • Returns a string whose Java literals are unescaped.
def string s1 = "Company: \"Askribe.com\"".unescapeJava(); // Company: "Askribe.com"
def string s2 = unescapeJava("Company: \"Askribe.com\""); // Company: "Askribe.com"

unescapeUnicode(string value)

  • Returns a string whose escaped Unicode characters are unescaped.
def string s1 = "De onde voc\\u00EA \\u00E9?".unescapeUnicode(); // De onde você é?
def string s2 = unescapeUnicode("De onde voc\\u00EA \\u00E9?"); // De onde você é?

unescapeXml(string value)

  • Unescapes the characters in a string using XML entities.
def string s1 = "&lt;Black&amp;White&gt;".unescapeXml(); // <Black&White>
def string s2 = unescapeXml("&lt;Black&amp;White&gt;"); // <Black&White>