Skip to content
Reference > Classes

String

Definition

String var = .... ;

Extends

Extended By

None

Description

A sequence of characters

Method Summary

Owner Name Return Type Description
String constructor(s) Object Initialize a string object
String after(toFind, origIfNotFound) String Get the portion of a string after the first occurence of a delimiter. If the delimiter is not found, then return either the original string or null depending on origIfNotFound param. Same as strAfter().
String afterLast(toFind, origIfNotFound) String Get the portion of a string after the last occurence of a delimiter. If the delimiter is not found, then return either the original string or null depending on origIfNotFound param. Same as strAfterLast().
String before(toFind, origIfNotFound) String Get the portion of a string before the first occurence of a delimiter. If the delimiter is not found, then return either the original string or null depending on origIfNotFound param. Same as strBefore().
String beforeLast(toFind, origIfNotFound) String Get the portion of a string before the last occurrence of a delimiter. If the delimiter is not found, then return either the original string or null depending on origIfNotFound param.
String charAt(index) Character Returns the character at the specified index.
String chars() List Returns a list whose length is the length of this string and whose contents are initialized to contain the character sequence represented by this string.
String cut(delim, fieldList) String Splits line into a list using the supplied delimiter and returns those fields listed by position. Result is joined using supplied delim. Same as strCut().
String decodeToByte() Byte Decodes a String into a Byte. Must be a number without any suffix.
String decodeToLong() Long Decodes a String into a Long. Must be a number without any suffix.
String decodeToShort() Short Decodes a String into a Short. Must be a number without any suffix.
String endsWith(suffix, ignore_case) Boolean Returns true if this string ends with the specified suffix, false otherwise. Same as strEndsWith().
Object getClassName() String Returns the string name of this object's class type.
String indexOf(to_find) Integer Returns the index within this string of the first occurrence of the specified string, returns -1 if no such occurrence is found. Same as strIndexOf() with one argument.
String indexOf(to_find, start_index) Integer Returns the index within this string of the first occurrence of the specified string, starting from a specific index, returns -1 if no such occurrence is found. Same as strIndexOf() with two arguments.
String is() Boolean Returns True if the string contains characters other than whitespace characters, such as tabs, newlines, and spaces; returns false otherwise. Same as strIs(). Opposite of isnt().
String isEmpty() Boolean Returns true if, and only if, length() is 0.
String isnt() Boolean Returns True if the string contains only the following whitespace characters: tabs, newlines, and spaces; return false otherwise. Same as strIsnt(). Opposite of is().
String lastIndexOf(to_find) Integer Returns the index within this string of the last occurrence of the specified string, returns -1 if not found. Same as strLastIndexOf(), the one without ignore case.
String lastIndexOf(to_find, last, ignore_case) Integer Returns the index within this string of the last occurrence of the specified string, starts the search from the specified index, backwards, returns -1 if not found. Same as strLastIndexOf(), with ignore case.
String length() Integer Returns the length of this string.
String replaceAll(to_replace, replacement) String Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence. Same as strReplace().
String splice(start, charsToReplace, replacement) String Replaces a base string's subsequence of chars with a replacement string. If start or charsToReplace extend beyond string limits, they will be set to string limits. Same as strSplice().
String split(delimiter) List Returns a list of strings, splited around matches of the given delimiter.
String splitLines() List Splits lines using line feed and line return chars.
String startsWith(s, ignore_case) Boolean Tests if this string starts with the specified prefix. Same as strStartsWith().
String startsWith(s, start, ignore_case) Boolean Tests if this string starts with the specified prefix, starting from the specific index.
String strip(prefix, suffix) String Same as strStrip(). Returns the substring of supplied text with the prefix and suffix removed. If the string doesn't start with the specified prefix, then the prefix is ignored. If the string doesn't end with suffix, then the suffix is ignored.
String substring(begin) String Returns a string that is a substring of this string, starting from the specific index to the end of the string.
String substring(begin, end) String Returns a string that is a substring of this string, start and end at specific index. Same as strSubstring().
Object toJson() String Returns a json representation of this object.
String toLower() String Converts all of the characters in this String to lower case using the rules of the default locale. Same as strLower().
String toUpper() String Converts all of the characters in this String to upper case using the rules of the default locale. Same as strUpper().
String trim() String Returns a string whose value is this string, with any leading and trailing whitespace removed. Same as strTrim().

Method Definitions


constructor(s)

String string = new String(String s)

Description

Initialize a string object

Parameter Definition

Name Type Description
s String  a String

after(toFind,origIfNotFound)

String String::after(String toFind, Boolean origIfNotFound)

Description

Get the portion of a string after the first occurence of a delimiter. If the delimiter is not found, then return either the original string or null depending on origIfNotFound param. Same as strAfter().

Parameter Definition

Name Type Description
toFind String  The delimiter to find
origIfNotFound Boolean  If the toFind parameter doesn't exist in the text, then return text if true or null if false.

afterLast(toFind,origIfNotFound)

String String::afterLast(String toFind, Boolean origIfNotFound)

Description

Get the portion of a string after the last occurence of a delimiter. If the delimiter is not found, then return either the original string or null depending on origIfNotFound param. Same as strAfterLast().

Parameter Definition

Name Type Description
toFind String  The delimiter to find
origIfNotFound Boolean  If the toFind parameter doesn't exist in the text, then return text if true or null if false.

before(toFind,origIfNotFound)

String String::before(String toFind, Boolean origIfNotFound)

Description

Get the portion of a string before the first occurence of a delimiter. If the delimiter is not found, then return either the original string or null depending on origIfNotFound param. Same as strBefore().

Parameter Definition

Name Type Description
toFind String  The delimiter to find
origIfNotFound Boolean  If the toFind parameter doesn't exist in the text, then return text if true or null if false.

beforeLast(toFind,origIfNotFound)

String String::beforeLast(String toFind, Boolean origIfNotFound)

Description

Get the portion of a string before the last occurrence of a delimiter. If the delimiter is not found, then return either the original string or null depending on origIfNotFound param.

Parameter Definition

Name Type Description
toFind String  The delimiter to find
origIfNotFound Boolean  If the toFind parameter doesn't exist in the text, then return text if true or null if false.

charAt(index)

Character String::charAt(Integer index)

Description

Returns the character at the specified index.

Parameter Definition

Name Type Description
index Integer  Location of the character

chars()

List String::chars()

Description

Returns a list whose length is the length of this string and whose contents are initialized to contain the character sequence represented by this string.


cut(delim,fieldList)

String String::cut(String delim, String fieldList)

Description

Splits line into a list using the supplied delimiter and returns those fields listed by position. Result is joined using supplied delim. Same as strCut().

Parameter Definition

Name Type Description
delim String  delimiter, literal not a pattern.
fieldList String  fields to return. Can use n-m for range; n,m... for individual fields or -n for first number or n- for last n entries.

decodeToByte()

Byte String::decodeToByte()

Description

Decodes a String into a Byte. Must be a number without any suffix.


decodeToLong()

Long String::decodeToLong()

Description

Decodes a String into a Long. Must be a number without any suffix.


decodeToShort()

Short String::decodeToShort()

Description

Decodes a String into a Short. Must be a number without any suffix.


endsWith(suffix,ignore_case)

Boolean String::endsWith(String suffix, Boolean ignore_case)

Description

Returns true if this string ends with the specified suffix, false otherwise. Same as strEndsWith().

Parameter Definition

Name Type Description
suffix String  string to test
ignore_case Boolean  true of ignore case, false otherwise.

indexOf(to_find)

Integer String::indexOf(String to_find)

Description

Returns the index within this string of the first occurrence of the specified string, returns -1 if no such occurrence is found. Same as strIndexOf() with one argument.

Parameter Definition

Name Type Description
to_find String  string to find

indexOf(to_find,start_index)

Integer String::indexOf(String to_find, Integer start_index)

Description

Returns the index within this string of the first occurrence of the specified string, starting from a specific index, returns -1 if no such occurrence is found. Same as strIndexOf() with two arguments.

Parameter Definition

Name Type Description
to_find String  string to find
start_index Integer  index to begin

is()

Boolean String::is()

Description

Returns True if the string contains characters other than whitespace characters, such as tabs, newlines, and spaces; returns false otherwise. Same as strIs(). Opposite of isnt().


isEmpty()

Boolean String::isEmpty()

Description

Returns true if, and only if, length() is 0.


isnt()

Boolean String::isnt()

Description

Returns True if the string contains only the following whitespace characters: tabs, newlines, and spaces; return false otherwise. Same as strIsnt(). Opposite of is().


lastIndexOf(to_find)

Integer String::lastIndexOf(String to_find)

Description

Returns the index within this string of the last occurrence of the specified string, returns -1 if not found. Same as strLastIndexOf(), the one without ignore case.

Parameter Definition

Name Type Description
to_find String  string to find

lastIndexOf(to_find,last,ignore_case)

Integer String::lastIndexOf(String to_find, Integer last, Boolean ignore_case)

Description

Returns the index within this string of the last occurrence of the specified string, starts the search from the specified index, backwards, returns -1 if not found. Same as strLastIndexOf(), with ignore case.

Parameter Definition

Name Type Description
to_find String  string to find
last Integer  index to begin
ignore_case Boolean  true if ignore case, false otherwise.

length()

Integer String::length()

Description

Returns the length of this string.


replaceAll(to_replace,replacement)

String String::replaceAll(String to_replace, String replacement)

Description

Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence. Same as strReplace().

Parameter Definition

Name Type Description
to_replace String  string to find
replacement String  string replacement

splice(start,charsToReplace,replacement)

String String::splice(Number start, Number charsToReplace, String replacement)

Description

Replaces a base string's subsequence of chars with a replacement string. If start or charsToReplace extend beyond string limits, they will be set to string limits. Same as strSplice().

Parameter Definition

Name Type Description
start Number  zero indexed start of replacement.
charsToReplace Number  length of chars to replace.
replacement String  text to replace specified subsequence with, null is treated as empty string.

split(delimiter)

List String::split(String delimiter)

Description

Returns a list of strings, splited around matches of the given delimiter.

Parameter Definition

Name Type Description
delimiter String 

splitLines()

List String::splitLines()

Description

Splits lines using line feed and line return chars.


startsWith(s,ignore_case)

Boolean String::startsWith(String s, Boolean ignore_case)

Description

Tests if this string starts with the specified prefix. Same as strStartsWith().

Parameter Definition

Name Type Description
s String  string to find
ignore_case Boolean  True if ignore case, False otherwise

startsWith(s,start,ignore_case)

Boolean String::startsWith(String s, Integer start, Boolean ignore_case)

Description

Tests if this string starts with the specified prefix, starting from the specific index.

Parameter Definition

Name Type Description
s String  string to find
start Integer  index to start
ignore_case Boolean  true if ignore case, false otheriwse

strip(prefix,suffix)

String String::strip(String prefix, String suffix)

Description

Same as strStrip(). Returns the substring of supplied text with the prefix and suffix removed. If the string doesn't start with the specified prefix, then the prefix is ignored. If the string doesn't end with suffix, then the suffix is ignored.

Parameter Definition

Name Type Description
prefix String  The prefix to strip
suffix String  The suffix to strip

substring(begin)

String String::substring(Integer begin)

Description

Returns a string that is a substring of this string, starting from the specific index to the end of the string.

Parameter Definition

Name Type Description
begin Integer  index to begin

substring(begin,end)

String String::substring(Integer begin, Integer end)

Description

Returns a string that is a substring of this string, start and end at specific index. Same as strSubstring().

Parameter Definition

Name Type Description
begin Integer  index to begin
end Integer  index to end

toLower()

String String::toLower()

Description

Converts all of the characters in this String to lower case using the rules of the default locale. Same as strLower().


toUpper()

String String::toUpper()

Description

Converts all of the characters in this String to upper case using the rules of the default locale. Same as strUpper().


trim()

String String::trim()

Description

Returns a string whose value is this string, with any leading and trailing whitespace removed. Same as strTrim().