- TIBCO BusinessEvents®
- Standard
- String

# String

## Description

Utility Functions to Operate on String and Char Properties

## Functions

Name | Signature and Synopsis
--- | ---
`append` | `Object append(Object stringBuffer, String stringToAppend)` Appends strings to the buffer passed to it.
`clearBuffer` | `void clearBuffer(Object stringBuffer)` Clears contents of the buffer passed to it.
`compareTo` | `int compareTo (String s1, String s2)` Compares two strings lexicographically.
`compareToIgnoreCase` | `int compareToIgnoreCase (String s1, String s2)` Compares two strings lexicographically, ignoring case differences.
`concat` | `String concat (String s1, String s2)` Concatenates the two argument strings and returns the resulting String.
`contains` | `boolean contains (String s1, String s2)` Tests if the String `s1` contains the String `s2`.``
`convertBufferToString` | `String convertBufferToString(Object stringBuffer)` Appends strings to the buffer passed to it.
`convertByteArrayToString` | `String convertByteArrayToString(Object bytesObject, String encoding)` A faster way of converting a `byte[]` to `String` object. This is especially useful when the buffer sizes are very large, where `String.getBytes(String)` is not optimal.
`createBuffer` | `Object createBuffer(int size)` Creates a new buffer to which strings can be appended instead of concat.
`endsWith` | `boolean endsWith (String s1, String suffix)` Tests if the String `s1` ends with the specified suffix.
`equals` | `boolean equals (String s1, String s2)` Compares two Strings and returns a boolean indicating whether they are equal.
`format` | `String format(String message, Object... arguments)` Returns the message string formatted with arguments.
`getBytes` | `Object getBytes(String s1, String charsetName)` Encodes a string to a sequence of `byte[]` using the named charset.
`hashCode` | `int hashCode (String s1)` Returns a hash code for the passed String.
`indexOfString` | `int indexOfString (String s1, int fromIndex, String s2)` Finds the index of the first occurrence of `s2` within `s1` that is at, or after, `fromIndex`.
`lastIndexOfString` | `int lastIndexOfString (String s1, int fromIndex, String s2)` Finds the index of the last occurrence of `s2` within `s1` that is at, or after, `fromIndex`.
`left` | `String left (String s1, int length)` Returning a String containing the first `length` characters of the string `s1`.
`length` | `int length (String s1)` Returns the length of the String passed in.
`matches` | `boolean matches (String s1, String regex)` Tells whether or not this string matches the given regular expression.
`pad` | `String pad (String s1, int length, String padCharacter)` Returns a string padded to the indicated length with the pad character.
`padFront` | `String padFront(String s1, int length, String padCharacter)` Returns a string front-padded to the indicated length with the pad character.
`regionMatches` | `boolean regionMatches (boolean ignoreCase, String s1, int offset1, String s2, int offset2, int length)` Tests if two string regions are equal.
`replace` | `String replace (String s1, char oldChar, char newChar)` Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar.
`replaceAll` | `String replaceAll (String s1, String regex, String replacement)` Replaces each substring of this string that matches the given regular expression with the given replacement.
`replaceFirst` | `String replaceFirst (String s1, String regex, String replacement)` Replaces the first substring of this string that matches the given regular expression with the given replacement.
`right` | `String right (String s1, int length)` Returning a String containing the last `length` characters of the string `s1`.
`split` | `String[] split(String str, String regex)` Splits this string around matches of the given regular expression. Trailing empty strings are not included in the resulting array. e.g. String.split($1This|is|a|test$1, $1$1$1$1$1|$1) returns a String[] of {$1This$1, $1is$1, $1a$1, $1test$1}.
`split2` | `String[] split2(String str, String regex, int limit)` Splits this string around matches of the given regular expression. The limit parameter controls the number of times the pattern is applied and therefore affects the length of the resulting array. If the limit n is greater than zero then the pattern will be applied at most n - 1 times, the array's length will be no greater than n, and the array's last entry will contain all input beyond the last matched delimiter. If n is non-positive then the pattern will be applied as many times as possible and the array can have any length. If n is zero then the pattern will be applied as many times as possible, the array can have any length, and trailing empty strings will be discarded . e.g. String.split2($1This|is|a|test$1, $1$1$1$1$1|$1,4) returns a String[] of {$1This$1, $1is$1, $1a$1, $1test$1}. e.g. String.split2($1##$1, $1#$1) returns an empty String[] and String.split2($1##$1, $1#$1, -1) returns {$1$1,$1$1,$1$1}
`startsWith` | `boolean startsWith (String s1, String prefix)` Tests if the String `s1` ends with the specified prefix.
`substring` | `String substring (String s1, int beginIndex, int endIndex)` Returns a new string that is a substring of this string.
`substringAfter` | `String substringAfter (String s1, String s2)` Returns the String after the first occurrence of the String `s2` in String `s1`
`substringBefore` | `String substringBefore (String s1, String s2)` Returns the String before the first occurrence of the String `s2` in String `s1`
`toLowerCase` | `String toLowerCase (String s1)` Converts all of the characters in the String passed to lower case using the rules of the default locale.
`toUpperCase` | `String toUpperCase (String s1)` Converts all of the characters in the String passed to upper case using the rules of the default locale.
`tokenize` | `String[] tokenize(String str, String delimiter)` Breaks an input string into tokens, returning tokens in a String[]. e.g. String.tokenize($1This is a test$1, null) returns a String[] of {$1This$1, $1is$1, $1a$1, $1test$1}.
`trim` | `String trim(String str)` Returns a copy of the string, with leading and trailing whitespace omitted.
`valueOfBoolean` | `String valueOfBoolean (boolean b)` Returns a String representation of the boolean passed in.
`valueOfDouble` | `String valueOfDouble (double d)` Returns a String representation of the double passed in.
`valueOfFloat` | `String valueOfFloat (float f)` Returns a String representation of the float passed in.
`valueOfInt` | `String valueOfInt (int i)` Returns a String representation of the int passed in.
`valueOfLong` | `String valueOfLong (long l)` Returns a String representation of the long passed in.