Text Functions
- ADDCSLASHES
Quote string with slashes in a C style
ADDCSLASHES("foo[ ]","A..z")Try this examplestr (string)The string to be escaped.charlist (string)A list of characters to be escaped. - ADDSLASHES
Quote string with slashes
ADDSLASHES("O'Reilly?")Try this examplestr (string)The string to be escaped. - CAPITALIZE
Makes capital letter the first character of every word
CAPITALIZE("some text")Try this exampletext (string)Text to transform - CHARAT
Returns the character at the specified index in a string
CHARAT(0,"HELLO WORLD")Try this exampleindex (number)An integer representing the index of the character you want to returnstring (string)String - CHARCODEAT
Returns the Unicode of the character at the specified index in a string
CHARCODEAT(0,"HELLO WORLD")Try this exampleindex (number)A number representing the index of the character you want to returnstring (string)String - CHR
Generate a single-byte string from a number
CHR(27)Try this examplebytevalue (number)An integer between 0 and 255. - CONTAINS
Determines whether a string contains the characters of a specified string. Case sensitive
CONTAINS("Hello world, welcome to the universe.","world")Try this examplestring (string)Stringsearchvalue (string)The string to search for - CONVERT_TO_ASCII
Removes all non-ASCII characters from string
CONVERT_TO_ASCII("abqwrešđčžsff")Try this exampletext (string)Text to transform - CONVERT_UUDECODE
Decode a uuencoded string
CONVERT_UUDECODE("+22!L;W9E(%!(4\"$`\n`")Try this exampledata (string)The uuencoded data. - CONVERT_UUENCODE
Uuencode a string
CONVERT_UUENCODE("test\ntext text\r\n")Try this exampledata (string)The data to be encoded. - CURRENCY_TO_WORDS
Converts currency to words
CURRENCY_TO_WORDS(5999,"USD","en")Try this examplenumber (number)Currency value, integer. To act like 4.99, use 499currency (string)Currency identifier ISO 4217 - DEFAULT_VALUE
Returns the default value if the first value is empty
DEFAULT_VALUE("","default")Try this exampleinput (string)Text to check if is emptydefault (string)Default value that will be returned - DUMMY_TEXT
Dummy text generator (lorem ipsum)
DUMMY_TEXT("words",4)Try this exampletype (string)Content type. Accepted values: "words", "sentences", "paragraphs"quantity (number)Quantity of content types - ENDSWITH
Determines whether a string ends with the characters of a specified string
ENDSWITH("Hello world, welcome to the universe.","universe.")Try this examplehaystack (string)Stringsearchvalue (string)The string to search for - FROMCHARCODE
Converts Unicode values into characters.
FROMCHARCODE(65)Try this examplenumber (number)Unicode value to be converted - ICONV
Convert string to requested character encoding
ICONV("UTF-8", "ISO-8859-1//TRANSLIT", "some text")Try this examplein_charset (string)The input charset.out_charset (string)The output charset. - IF_TEXT_ENDS
Determines whether a string ends with the characters of a specified string
IF_TEXT_ENDS("Hello world, welcome to the universe.","universe.")Try this examplehaystack (string)Stringsearchvalue (string)The string to search for - IF_TEXT_MATCH
Determines whether a string contains the characters of a specified string. Case sensitive
IF_TEXT_MATCH("Hello world, welcome to the universe.","world")Try this examplestring (string)Stringsearchvalue (string)The string to search for - IF_TEXT_STARTS
Determines whether a string begins with the characters of a specified string.
IF_TEXT_STARTS("Hello world, welcome to the universe.","Hello")Try this examplehaystack (string)Stringsearchvalue (string)The string to search for - INCLUDES
Determines whether a string contains the characters of a specified string. Case sensitive
INCLUDES("Hello world, welcome to the universe.","world")Try this examplestring (string)Stringsearchvalue (string)The string to search for - INDEXOF
Returns the position of the first occurrence of a specified value in a string.
INDEXOF("Hello world, welcome to the universe.","welcome")Try this examplestring (string)Stringsearchvalue (string)The string to search for - IS_PALINDROME
Determines whether a string is palindrome
IS_PALINDROME("madam")Try this examplestring (string)String or phrase to checl - LASTINDEXOF
Returns the position of the last occurrence of a specified value in a string or last element index in array
LASTINDEXOF("Hello planet earth, you are a great planet.","planet")Try this examplemixed (mixed)String or Arraysearchvalue (string)The string to search for - LENGTH
Returns the length of a string (number of characters) or element count in array
LENGTH("Hello World!")Try this examplemixed (mixed)String or Array - LOREMIPSUM
Lorem Ipsum generator
LOREMIPSUM("words",4)Try this exampletype (string)Content type. Accepted values: "words", "sentences", "paragraphs"quantity (number)Quantity of content types - LOWERCASE
Make a string lowercase
LOWERCASE("Mary Had A Little Lamb and She LOVED It So")Try this examplestring (string)The input string. - LTRIM
Strip whitespace (or other characters) from the beginning of a string
LTRIM("\t\tThese are a few words :) ... ")Try this examplestr (string)The input string.character_mask (string)Optional: You can also specify the characters you want to strip, by means of the character_mask parameter. Simply list all characters that you want to be stripped. With .. you can specify a range of characters. - MB_STRLEN
Get string length
MB_STRLEN("some text","UTF-8")Try this examplestr (string)The string being checked for length.encoding (string)The encoding parameter is the character encoding. If it is omitted, the internal character encoding value will be used. - MB_STRPOS
Find position of first occurrence of string in a string
MB_STRPOS("some text","some")Try this examplehaystack (string)The string being checked.needle (string)The string to find in haystack. In contrast with strpos(), numeric values are not applied as the ordinal value of a character. - MB_STRTOLOWER
Make a string lowercase. Returns string with all alphabetic characters converted to lowercase.
MB_STRTOLOWER("some text","UTF-8")Try this examplestr (string)The string being lowercased.encoding (string)The encoding parameter is the character encoding. If it is omitted, the internal character encoding value will be used. - MB_STRTOUPPER
Make a string uppercase. Returns string with all alphabetic characters converted to uppercase.
MB_STRTOUPPER("some text","UTF-8")Try this examplestr (string)The string being uppercased.encoding (string)Optional: The encoding parameter is the character encoding. If it is omitted, the internal character encoding value will be used. - MB_SUBSTR
Get part of string
MB_SUBSTR("some text",0,1)Try this examplestr (string)The string to extract the substring from.start (number)If start is non-negative, the returned string will start at the start'th position in str, counting from zero. For instance, in the string 'abcdef', the character at position 0 is 'a', the character at position 2 is 'c', and so forth. If start is negative, the returned string will start at the start'th character from the end of str. - MIRROR_TEXT
Reverse the string
MIRROR_TEXT("Hello World!")Try this examplestring (string)Text or phrase - NL2BR
Inserts HTML line breaks before all newlines in a string
NL2BR("foo isn't\n bar")Try this examplestring (string)The input string. - NUMBER_FORMAT
Format a number with grouped thousands
NUMBER_FORMAT(1234.56)Try this examplenumber (number)The number being formatted.decimals (string)Optional: Sets the number of decimal points. - NUMBER_TO_WORDS
Converts number to words
NUMBER_TO_WORDS(1200,"en")Try this examplenumber (number)Integer to transformlanguage (string)Optional: RFC 3066 language identifier. Default "en" - ORD
Convert the first byte of a string to a value between 0 and 255
ORD("A")Try this examplestring (string)A character. - PARSEFLOAT
Parses a string and returns a floating point number.
PARSEFLOAT("40 years")Try this examplestring (string)The string to be parsed - PARSEINT
Parses a string and returns an integer
PARSEINT("10.33")Try this examplestring (string)The string to be parsed - PLURALIZE
Transforms all words into plural (EN, RU). (cookie - cookies, man - men, potato - potatoes)
PLURALIZE("apple","en")Try this examplestring (string)Text to pluralizelanguage (string)Language code, 2 character format. Default = "en" - PREG_REPLACE
Perform a regular expression search and replace
PREG_REPLACE("/(\w+) (\d+), (\d+)/i","${1}1,$3","April 15, 2003")Try this examplepattern (string)The pattern to search for. It can be either a string or an array with strings.replacement (string)The string to replace. - QUOTEMETA
Quote meta characters
QUOTEMETA("Hello world. (can you hear me?)")Try this examplestr (string)The input string. - RANDOM_NAME
Generates random First name and Last name
RANDOM_NAME("full")Try this exampletype (string)Accepted modes: "first", "last" or "full" - RANDOM_STRING
Generates random alphabetic string
RANDOM_STRING(10)Try this exampletype (number)Length of the stringadd_numbers (boolean)Optional: Add numbers in string. Default = TRUE - REPEAT
Returns a new string with a specified number of copies of the string it was called on.
REPEAT("Hello world!",2)Try this examplestring (string)Stringcount (number)The number of times the original string value should be repeated in the new string - RTRIM
Strip whitespace (or other characters) from the end of a string
RTRIM("\t\tThese are a few words :) ... ")Try this examplestr (string)The input string.character_mask (string)Optional: You can also specify the characters you want to strip, by means of the character_mask parameter. Simply list all characters that you want to be stripped. With .. you can specify a range of characters. - SIMILAR_TEXT
Calculate the similarity between two strings
SIMILAR_TEXT("bafoobar","barfoo")Try this examplefirst (string)The first string.second (string)The second string. - SINGULARIZE
Transforms all words into singular (EN, RU). (cookies - cookie, men - man, potatoes - potato)
SINGULARIZE("apples","en")Try this examplestring (string)Text to singularizelanguage (string)Language code, 2 character format. Default = "en" - SPLIT_TEXT
Splits the text by specific character or a word. Returns a specified part by index, starting from 0
SPLIT_TEXT("11-22-33","-",0)Try this examplestring (string)Text to splitdelimiter (string)Delimiter - STARTCASE
Make a string uppercase. Returns string with all alphabetic characters converted to uppercase.
STARTCASE("some text")Try this examplestr (string)The string being uppercased. - STARTSWITH
Determines whether a string begins with the characters of a specified string.
STARTSWITH("Hello world, welcome to the universe.","Hello")Try this examplehaystack (string)Stringsearchvalue (string)The string to search for - STR_IREPLACE
Case-insensitive Replace all occurrences of the search string with the replacement string
STR_IREPLACE("%body%", "black", "<body text=%BODY%>")Try this examplesearch (string)The value being searched for, otherwise known as the needle.replace (string)The replacement value that replaces found search values. - STR_PAD
Pad a string to a certain length with another string
STR_PAD("input",10,"pp")Try this exampleinput (string)The input string.pad_length (number)If the value of pad_length is negative, less than, or equal to the length of the input string, no padding takes place, and input will be returned. - STR_REPEAT
Repeat a string
STR_REPEAT("-=",10)Try this exampleinput (string)The string to be repeated.multiplier (number)Number of time the input string should be repeated - has to be greater than or equal to 0. If the multiplier is set to 0, the function will return an empty string. - STR_REPLACE
Replace all occurrences of the search string with the replacement string
STR_REPLACE("%body%", "black", "<body text='%body%'>")Try this examplesearch (string)The value being searched for, otherwise known as the needle.replace (string)The replacement value that replaces found search values. - STR_ROT13
Perform the rot13 transform on a string
STR_ROT13("Antify")Try this examplestr (string)The input string. - STR_SHUFFLE
Randomly shuffles a string
STR_SHUFFLE("abcdef")Try this examplestr (string)The input string. - STR_SPLIT
Convert a string to an array
STR_SPLIT("Hello world")Try this examplestring (string)The input string.split_length (number)Optional: Maximum length of the chunk. Default = 1 - STR_WORD_COUNT
Return information about words used in a string
STR_WORD_COUNT("text of 4 words")Try this examplestring (string)The string to be analyzed - STRIPCSLASHES
Un-quote string quoted with ADDCSLASHES
STRIPCSLASHES("we are escaping \r\n")Try this examplestr (string)The string to be unescaped. - STRIPOS
Find the position of the first occurrence of a case-insensitive substring in a string
STRIPOS("xyz","a")Try this examplehaystack (string)The string to search in.needle (string)Note that the needle may be a string of one or more characters. - STRIPSLASHES
Un-quotes a quoted string
STRIPSLASHES("Is your name O'reilly?")Try this examplestr (string)The input string. - STRISTR
Case-insensitive Find the first occurrence of a string
STRISTR("[email protected]","e")Try this examplehaystack (string)The string to search inneedle (string)The string to search for - STRLEN
Get string length
STRLEN("abcdef")Try this examplestring (string)The string being measured for length. - STRPOS
Find the position of the first occurrence of a substring in a string
STRPOS("abc","a")Try this examplehaystack (string)The string to search in.needle (string)The string to search for. - STRRCHR
Find the last occurrence of a character in a string
STRRCHR("http://example.com/path/file.php","/")Try this examplehaystack (string)The string to search inneedle (string)If needle contains more than one character, only the first is used. - STRREV
Reverse a string
STRREV("Hello world!")Try this examplestring (string)The string to be reversed. - STRRIPOS
Find the position of the last occurrence of a case-insensitive substring in a string
STRRIPOS("ababcd","aB")Try this examplehaystack (string)The string to search in.needle (string)The string to search for. - STRRPOS
Find the position of the last occurrence of a substring in a string
STRRPOS("0123456789a123456789b123456789c","0")Try this examplehaystack (string)The string to search in.needle (string)The string to search for. - STRSPN
Finds the length of the initial segment of a string consisting entirely of characters contained within a given mask
STRSPN("foo","o")Try this examplesubject (string)The string to examine.mask (string)The list of allowable characters. - STRSTR
Find the first occurrence of a string
STRSTR("[email protected]","@")Try this examplehaystack (string)The input string.needle (string)The string to search for - STRTOLOWER
Make a string lowercase
STRTOLOWER("Mary Had A Little Lamb and She LOVED It So")Try this examplestring (string)The input string. - STRTOUPPER
Make a string uppercase
STRTOUPPER("Mary Had A Little Lamb and She LOVED It So")Try this examplestring (string)The input string. - SUBSTR
Return part of a string
SUBSTR("abcdef",0,-1)Try this examplestring (string)The input string.start (number)If start is non-negative, the returned string will start at the start'th position in string, counting from zero - SUBSTR_COUNT
Count the number of substring occurrences
SUBSTR_COUNT("This is a test","is")Try this examplehaystack (string)The string to search inneedle (string)The substring to search for - SUBSTR_REPLACE
Replace text within a portion of a string
SUBSTR_REPLACE("ABCDEFGH:/MNRPQR/","bob",10,-1)Try this examplestring (string)The input string.replacement (string)The replacement string. - SUBSTRING
Extracts the characters from a string, between two specified indices, and returns the new sub string
SUBSTRING("Hello world!",1,4)Try this examplestring (string)Stringstart (number)The position where to start the extraction. First character is at index 0 - TEXT_LOWERCASE
Converts a string to lowercase letters.
TEXT_LOWERCASE("Hello World!")Try this examplestring (string)String - TEXT_REPLACE
Replace all occurrences of the search string with the replacement string
TEXT_REPLACE("%body%", "black", "<body text='%body%'>")Try this examplesearch (string)The value being searched for, otherwise known as the needle.replace (string)The replacement value that replaces found search values. - TEXT_TITLE
Makes capital letter the first character of every word
TEXT_TITLE("some text")Try this exampletext (string)Text to transform - TEXT_UPPERCASE
Converts a string to uppercase letters.
TEXT_UPPERCASE("Hello World!")Try this examplestring (string)String - TOLOWERCASE
Converts a string to lowercase letters.
TOLOWERCASE("Hello World!")Try this examplestring (string)String - TOSTRING
Convert a Boolean value to a string
TOSTRING(TRUE)Try this examplevar (any)Boolean, string or number - TOUPPERCASE
Converts a string to uppercase letters.
TOUPPERCASE("Hello World!")Try this examplestring (string)String - TRIM_WHITESPACE
Removes leading whitespaces from text
TRIM_WHITESPACE(" text with whitespases ")Try this exampletext (string)Text to remove whitespaces from - TRUNCATE
Limits the text string to a specific length of characters
TRUNCATE("some long text",3)Try this exampletext (string)Text to limitmax_length (number)Max number of characters of the result - UCFIRST
Make a string's first character uppercase
UCFIRST("hello world!")Try this examplestr (string)The input string. - UCWORDS
Uppercase the first character of each word in a string
UCWORDS("hello world!")Try this examplestr (string)The input string.delimiters (string)Optional: The optional delimiters contains the word separator characters. - UPPERCASE
Converts a string to uppercase letters.
UPPERCASE("Hello World!")Try this examplestring (string)String - WORD_COUNT
Returns the number of words in a string
WORD_COUNT("hello world!")Try this examplestring (string)Some text - WORDWRAP
Wraps a string to a given number of characters
WORDWRAP("The quick brown fox jumped over the lazy dog.",20,"<br />\n")Try this examplestr (string)The input string.width (number)The number of characters at which the string will be wrapped.