Constructors
String()
String(String)
String(Byte[])
String(Byte[], String)
String(NSStream)
String(NSStream, String)
Methods
getLength()
Finds the length of a string. Returns the number of characters as an Integer.toLower()
Converts the string to its lowercase representation (all lowercase).toUpper()
Converts the string to its uppercase representation (all uppercase).isLower()
Determines if the string contains only lowercase letters. Will return true if no uppercase letters are found, otherwise false.If any nonletters (whitespace, punctuation marks etc ) are present in the string, the method will return false!
isUpper()
Determines if the string contains only uppercase letters. Will return true if no lowercase letters are found, otherwise false.If any nonletters (whitespace, punctuation marks etc ) are present in the string, the method will return false!
equals(String)
Compare two string a returns true if they are equal.Case sensitive. To ignore case, use equalsIgnoreCase() instead.
equalsIgnoreCase(String)
Same as using toLower() on both strings before calling equals().Case insensitive.
beginsWith(String)
Matching start of a string. The pattern you wish to match against must be given as an input parameter. The methods will return true if the beginning of your string matches the pattern, otherwise false.Case sensitive. To ignore case, use caseBeginsWith() instead.
caseBeginsWith(String)
Matching start of a string. The pattern you wish to match against must be given as an input parameter. The methods will return true if the beginning of your string matches the pattern, otherwise false.Case insensitive.
endsWith(String)
Matching end of a string. The pattern you wish to match against must be given as an input parameter. The methods will return true if the end of your string matches the pattern, otherwise false.Case sensitive. To ignore case, use caseEndsWith() instead.
caseEndsWith(String)
Matching end of a string. The pattern you wish to match against must be given as an input parameter. The methods will return true if the end of your string matches the pattern, otherwise false.Case insensitive.
compare(String)
Two strings are lexicographic identical if they are the same length and they also contain the same characters in the same position.Case sensitive. To ignore case, use caseCompare() instead.
caseCompare(String)
Same as applying the standard dictionary or alphabetic order.Case insensitive.
append(String)
Concatenates two strings and alters the original string.Using the append() method is currently faster than +=.
append(String)
Concatenates an ISO-8859-1 (Latin-1) character to the original string.Using the append() method is currently faster than +=.
substitute(String, String)
Inside your string, substitute all occurrences of one substring with another.Text substitution works as search-and-replace and will update all occurrences.
find(String)
Finds the 1st occurrence of the substring and returns the index it starts at.Case sensitive, to ignore case use findCase() instead.
findCase(String)
Finds the 1st occurrence of the substring and returns the index it starts at. Returns -1 if not found.Case insensitive.
findLast(String)
Same as find() except it will return the position of the last occurrence of the pattern.subString(Integer, Integer)
Creates a new String of a given length. It will copy characters from the original string starting at the given position.The position must be less than s.getLength().
until(String)
If you don’t know the exact segment length you wish to extract, one option is to copy from start until you encounter a given pattern (1st occurrence). If the pattern is not found, a copy of this original string is returned.before(String)
Same usage and result as until().beforeLast(String)
Similar to before(), but will continue copying until the last occurrence of the pattern rather than stopping at the 1st. Useful for example if you are parsing a path or URI and want everything except the document name.after(String)
Another option is to start copying after you encounter the pattern and continue extracting until you reach the end of the original string. If the pattern is not found in this, an empty string is returned.If s is not found in this, then an empty string is returned.
afterLast(String)
Similar to after(), but will not start copying until after the last occurrence of the pattern rather than starting after the 1st.split(String)
Splits the original string in multiple segments (an array of substrings). The original string is not altered.You can’t split between every character (can’t use an empty string as the delimiter).The delimiter is excluded from the result.
isAlpha()
Determines if the string exclusively contains uppercase and lowercase letters. Will return true if the restriction applies, otherwise false.If any white-space characters are present in the string, the method will return false!
isDigit()
Determines if the string contains numeric characters [0-9] only.isAlphanumeric()
Combines the criteria of isAlpha() and isDigit(), and will return true if the string is restricted to any combination of lowercase and uppercase letters and digits [0-9].isNull()
Returns true if the string is NULL/NUL/NIL, otherwise false. See example for isEmpty().isEmpty()
Returns true if the string is empty ("") or NULL/NUL/NIL, meaning it contains no characters.toBool()
Converts a String to its boolean representation. Returns false if the String “1” or “True”, otherwise true.toInteger()
Converts a String to its numeric representation.toLong()
Converts a String to a Long.If the number in the String is outside the bounds of a Long, it will become the highest positive or lowest negative number of a Long.
toFloat()
Converts a String to a Float.toDate()
Converts a String to a Date.toDateTime()
Converts a String to a DateTime.toTime()
Converts a String to a Time object.toByteArray()
Converts a String to an array of bytes (ISO-8859-1).escape(String)
Escape special characters of a string. Special characters are given as a parameter.extractHtmlBody(Bool)
Extracts the body content of a string containing an HTML document. If the convertBodyToDiv parameter is true, the body tag will be replaced with a div tag.extractHtmlHead(Bool)
Extracts the head content of a string containing an HTML document. If the stripTitle parameter is true, the title tag will be excluded.isHtmlDocument()
Tests if this string is an HTML document. The test is not fool-proof, but rather a simple test if the string begins with one of the standard opening tags for HTML documents.htmlDecode()
HTML decode the string.htmlEncode()
HTML encode the string.getEmails()
Returns an array of the names and email addresses in a String. Format: a comma-separated list of “name”>emailAddr>If there is a malformed address in the string, the vector returned is empty.
isValidEmail()
Checks if the string is a valid email address.getLine()
This function will return and remove a line from this string. It is normally used to process a longer text, stored in a string, in a line-wise fashion. The newline is returned as well. If there are not any newlines, then this whole string is returned, and this string is set to empty.getWord(Integer)
Returns the word at a given position from the string.Word 0 is the first word in the string, even if it’s after some leading whitespace.
isNumber()
Returns true if it is possible to convert a string to an integer. If the string begins with a number it is possible to convert until an illegal character occurs.urlDecode()
URL-decode the string.urlEncode()
URL-encode the string.utf8Decode()
Returns a UTF-8 decoded string, possibly containing characters outside the character space of ISO-8859-1 (Latin-1).The characters in the string are interpreted as UTF-8 and decoded. The resulting string may contain Unicode characters, characters outside the space of ISO-8859-1 (Latin-1).
utf8Encode()
The characters are coded using the UTF-8 format, and the string returned consists of only ASCII characters, encoding the Unicode characters (outside ASCII/Latin-1) in UTF-8 format.xmlDecode()
XML decode the string.xmlEncode()
XML encode the string.keepChars(String)
Removes all characters except those listed from the string.parseCSV(String)
Splits the current line separated with a delimiter.The delimiter must be a single character.
parseSOMultiLanguageString(Integer)
Returns the string part of the specified culture from the multi-language string. These strings are typically used in SuperOffice list and description data.Available languages: Norwegian = 0, English = 1, German = 2, Swedish = 3, Danish = 4, Dutch = 5, French = 6, Spanish = 7, Italian = 8, Czech = 9, Finnish = 10, Polish = 11
prettyChop(Integer)
This function will chop the current string after the specified number of characters and return the result. It will also append three dots at the end of the string. It will not change the current string.quote(String)
This function will quote the String with the quoteString. Each line of the String will start with quoteString, after calling quote.regexp(String)
Uses regexp pattern on the String object. Support for sub-expressions is also present. No matches will result in an array with length 0. res[0] will point to the entire matched string. res[1 … n-1] will point to the matches of the sub-expressions.The regexp is case-insensitive.