String Functions

String Functions

A function is a set of code, that takes a finite number of input and optionally returns a value. Functions that operate on string expression are classified as string functions, they include functions for finding the length of a given text, remove certain words from a text etc.

In all the given functions, the original string is not changed by the function, only the return value is affected by these functions.

FunctionDescription
<string1>.contains(<string2>)Returns true if string2 is a substring of string1, otherwise false.
<string1>.endsWith(<string2>)Returns true if string1 ends with string2
<string1>.startsWith(<string2>)Returns true if string1 starts with string2
<string>.remove(<substring>)Removes the substring from the given string.
<string>.removeFirstOccurence(<substring>)Removes the first occurence of the substring from the given string..
<string>.removeLastOccurence(<substring>)Removes the last occurence of the second argument string from the first argument string.
<string>.getSuffix(<substring>)Returns the string after the specified substring.
<string>.getPrefix(<substring>)Returns the string before the specified substring.
<string>.toUpperCase()Convert the string to uppercase.
<string>.toLowerCase()Convert the string to lowercase.
<string>.getAlphaNumeric()Returns only the alphanumeric present in the specified string.
<string>.getAlpha()Returns only the alphabets present in the specified string.
<string>.removeAllAlphaNumeric()Remove all the alphanumeric present in the specified string.
<string>.removeAllAlpha()Remove all the alphabets present in the specified string.
<string>.length()Returns the length of the given string as an integer value.
<string>.getOccurence
Count(<substring>)
Returns the number of times a substring is present in the given string.
<string>.indexOf(<substring>)Returns the index of the first occurence of the substring in the given string
<string>.lastIndexOf(<substring>)Returns the index of the last occurence of the substring in the given string
<string>.substring(<
<s.index>, <e.index>)
Returns the string from the specified startindex to the endindex.
<string>.trim()Removes any leading and trailing space
from a string
<string1>.equalsIgnoreCase
<string2>
Returns true if <string1> equals <string2>.
<expression>.toStringConverts any type of expression to string.
Refer the behavior of toString() when applied to date/time
value.
<string>.matches
(<regular expression>)
Returns true if the given string matches regular expression given as argument.
<string>.replaceAll
(<searchString>,
<replacementString>
,false)
)
Replaces all occurrence of the string that matches the given <searchString> expression with the given <replacementString>.
<string>.replaceFirst
(<searchString>,
<replacementString>,
false)
Replaces the first occurrence of the string that matches the given <searchString> expression with the given <replacementString>.

 

leftpad(str)

Returns the input string with whitespace characters padded to the left of the string.
rightpad(str)Returns the input string with whitespace characters padded to the right of the string.

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohocreator.com