string

String Methods

lSParseDateTime(locale=[string], timezone=[string], format=[string])

Parses a locale-specific datetime string or object

Arguments:

parseDateTime(format=[string], timezone=[string])

Parses a datetime string or object

Arguments:

toDateTime(format=[string], timezone=[string])

Parses a datetime string or object

Arguments:

hash(algorithm=[string], encoding=[string], numIterations=[integer])

Creates an algorithmic hash of an object

Arguments:

hmac(key=[string], algorithm=[string], encoding=[string], numIterations=[integer])

Creates an algorithmic hash of an object

Arguments:

inputBaseN(radix=[numeric])

Converts a string, using the base specified by radix, to an integer.

Arguments:

xMLFormat(escapeChars=[boolean])

Formats a string so that special XML characters can be used as text in XML

Arguments:

uRLEncodedFormat()

Generates a URL-encoded string.

For example, it replaces spaces with %20, and non-alphanumeric characters with equivalent hexadecimal escape sequences. Passes arbitrary strings within a URL. *

len()

Returns the absolute value of a number

listSome(callback=[function:Predicate], delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean], parallel=[boolean], maxThreads=[integer])

Tests whether any item in a list meets the specified callback

Arguments:

listReduceRight(callback=[function:BiFunction], initialValue=[any], delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean])

Run the provided udf over a reversed delimited list to reduce the values to a single output

Arguments:

listPrepend(value=[string], delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean])

Filters a delimted list and returns the values from the callback test

Arguments:

listFirst(delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean])

Returns the first or last item in a delimited list, according to the specified function name

Arguments:

listLast(delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean])

Returns the first or last item in a delimited list, according to the specified function name

Arguments:

listIndexExists(index=[numeric], delimiter=[string], includeEmptyFields=[boolean])

Checks if a list has a given index

Arguments:

listInsertAt(position=[integer], value=[string], delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean])

Filters a delimted list and returns the values from the callback test

Arguments:

listChangeDelims(newDelimiter=[string], delimiter=[string], includeEmptyFields=[boolean])

Converts the delimiters of a list to the new delimiter.

Arguments:

listFind(value=[string], delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean])

Return int position of value in delimited list, case sensitive or case-insenstive variations

Arguments:

listFindNoCase(value=[string], delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean])

Return int position of value in delimited list, case sensitive or case-insenstive variations

Arguments:

listContains(value=[string], delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean])

Return int position of value in delimited list, case sensitive or case-insenstive variations

Arguments:

listContainsNoCase(value=[string], delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean])

Return int position of value in delimited list, case sensitive or case-insenstive variations

Arguments:

listCompact(delimiter=[string], multiCharacterDelimiter=[boolean])

Compacts a list by removing empty items from the start and end of the list

Arguments:

listTrim(delimiter=[string], multiCharacterDelimiter=[boolean])

Compacts a list by removing empty items from the start and end of the list

Arguments:

listMap(callback=[function:Function], delimiter=[string], includeEmptyFields=[boolean], parallel=[boolean], maxThreads=[integer])

Used to iterate over a delimited list and run the function closure for each item in the list and create a new list from the returned values.

Arguments:

listDeleteAt(position=[numeric], delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean])

Deletes an element from a list.

Returns a copy of the list, without the specified element.

Arguments:

listRemoveDuplicates(delimiter=[string], ignoreCase=[boolean])

De-duplicates a delimited list - either case-sensitively or case-insenstively

Arguments:

listToArray(delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean])

Converts a delimited list to an array

Arguments:

listQualify(qualifier=[string], delimiter=[string], elements=[string], includeEmptyFields=[boolean])

Inserts a string at the beginning and end of list elements.

Arguments:

listAppend(value=[string], delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean])

Appends an element to a list

Arguments:

listValueCount(value=[string], delimiter=[string], includeEmptyFields=[boolean])

returns a count of the number of occurrences of a value in a list

Arguments:

listValueCountNoCase(value=[string], delimiter=[string], includeEmptyFields=[boolean])

returns a count of the number of occurrences of a value in a list

Arguments:

listAvg(delimiter=[string], multiCharacterDelimiter=[boolean])

Gets the average of all values in a list

Arguments:

listLen(delimiter=[string], includeEmptyFields=[boolean])

Calculates the length of a list separated by the specified delimiter

Arguments:

listRest(delimiter=[string], includeEmptyFields=[boolean], offset=[integer])

Returns the remainder of a list after removing the first item

Arguments:

listGetAt(position=[numeric], delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean])

Retrieves an item from a delimited list at the specified position

Arguments:

listEvery(callback=[function:Predicate], delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean], parallel=[boolean], maxThreads=[integer])

Tests whether all items in a list meet the specified callback

Arguments:

listEach(callback=[function:Consumer], delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean], parallel=[boolean], maxThreads=[integer], ordered=[boolean])

Used to iterate over a delimited list and run the function closure for each item in the list.

Arguments:

listSort(sortType=[any], sortOrder=[string], delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean], localeSensitive=[boolean], callback=[any])

Sorts a delimited list and returns the result

Arguments:

listSetAt(position=[integer], value=[string], delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean])

Retrieves an item in to a delimited list at the specified position

Arguments:

listFilter(filter=[function:Predicate], delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean], parallel=[boolean], maxThreads=[integer])

Filters a delimted list and returns the values from the callback test

Arguments:

getToken(index=[integer], delimiter=[string])

Determines whether a token of the list in the delimiters parameter is present in a string.

Returns the token found at position index of the string, as a string. If index is greater than the number of tokens in the string, returns an empty string.

Arguments:

listItemTrim(delimiter=[string], includeEmptyFields=[boolean])

Trims each item in the list.

Arguments:

prettifyJSON()

Prettifies a JSON string.

jSONDeserialize(strictMapping=[boolean], useCustomSerializer=[string])

Converts a JSON (JavaScript Object Notation) string data representation into data, such as a structure or array.

Arguments:

toBase64(encoding=[string])

Calculates the Base64 representation of a string or binary object.

The Base64 format uses printable characters, allowing binary data to be sent in forms and e-mail, and stored in a database or file.

Arguments:

toBinary()

Calculates the binary representation of Base64-encoded data.

to(encoding=[string])

Converts a value to a string.

Arguments:

toJSON(queryFormat=[string], useSecureJSONPrefix=[boolean], useCustomSerializer=[boolean])

Converts a BoxLang variable into a JSON (JavaScript Object Notation) string.

Arguments:

listToJSON(queryFormat=[string], useSecureJSONPrefix=[boolean], useCustomSerializer=[boolean])

Converts a BoxLang variable into a JSON (JavaScript Object Notation) string.

Arguments:

booleanFormat()

Returns the value formatted as a boolean string

isEmpty()

Determine whether a given value is empty

spanIncluding(set=[string])

Gets characters from a string, from the beginning to a character that is NOT in a specified set of characters.

The search is case-sensitive.

Arguments:

reFind(reg_expression=[string], start=[integer], returnSubExpressions=[boolean], scope=[string])

Uses a regular expression (RE) to search a string for a pattern, starting from a specified position.

The search is case-sensitive. It will return numeric if returnsubexpressions is false and a struct of arrays named "len", "match" and "pos" when returnsubexpressions is true.

Arguments:

reFindNoCase(reg_expression=[string], start=[integer], returnSubExpressions=[boolean], scope=[string])

Uses a regular expression (RE) to search a string for a pattern, starting from a specified position.

The search is case-sensitive. It will return numeric if returnsubexpressions is false and a struct of arrays named "len", "match" and "pos" when returnsubexpressions is true.

Arguments:

kebabCase()

Convert a string to kebab case

ascii()

Determine the ASCII value of a character

val()

Converts numeric characters and the first period found that occur at the beginning of a string to a number.

A period not accompianied by at least one numeric digit will be ignored. If no numeric digits are found at the start of the string, zero will be returned.

compare(string2=[any])

Performs a case-sensitive comparison of two strings.

-1, if string1 is less than string2 0, if string1 is equal to string2 1, if string1 is greater than string2

Arguments:

trueFalseFormat()

Return Yes/No based on whether the input is true/false

reReplace(regex=[string], substring=[string], scope=[string])

Uses a regular expression (regex) to search a string for a string pattern and replace it with another.

The search is case-sensitive.

Arguments:

reReplaceNoCase(regex=[string], substring=[string], scope=[string])

Uses a regular expression (regex) to search a string for a string pattern and replace it with another.

The search is case-sensitive.

Arguments:

stripCR()

Deletes return characters from a string.

insert(substring=[string], position=[integer])

Inserts a substring into another string at a specified position.

Arguments:

camelCase()

Convert a string to camel case

bind(placeholders=[structloose])

This BIF allows you to bind a string with placeholders to a set of values.

Each placeholder is defined as ,{@code ${placeholder-name}}, and can be used anywhere and multiple times in the string.

Arguments:

snakeCase()

Convert a string to snake case

right(count=[integer])

Extract the rightmost count characters from a string

Arguments:

findOneOf(set=[string], start=[integer])

Finds the first occurrence of any character in a set of characters, from a specified start position.

Arguments:

spanExcluding(set=[string])

Get characters from a string, from the beginning to a character that is in a specified set of characters.

The search is case-sensitive.

Arguments:

compareNoCase(string2=[string])

Performs a case-insensitive comparison of two strings.

-1, if string1 is less than string2 0, if string1 is equal to string2 1, if string1 is greater than string2

Arguments:

stringReduceRight(callback=[function:BiFunction], initialValue=[any], delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean])

Run the provided udf over a reversed string to reduce the values to a single output

Arguments:

reverse()

Reverse the order of characters in a string

replace(substring1=[string], obj=[string], scope=[string])

Replaces occurrences of substring1 in a string with obj, in a specified scope.

The search is case-sensitive. Function returns original string with replacements made

Arguments:

replaceList(list1=[string], list2=[string], delimiter_list1=[string], delimiter_list2=[string], includeEmptyFields=[boolean])

Replaces occurrences of the elements from a delimited list, in a string with corresponding elements from another delimited list.

Arguments:

replaceListNoCase(list1=[string], list2=[string], delimiter_list1=[string], delimiter_list2=[string], includeEmptyFields=[boolean])

Replaces occurrences of the elements from a delimited list, in a string with corresponding elements from another delimited list.

Arguments:

slugify(maxLength=[numeric], allow=[string])

Slugify a string for URL safety

Arguments:

wrap(limit=[integer], strip=[boolean])

nullArguments:

pascalCase()

Convert a string to pascal case

stringSort(sortType=[any], sortOrder=[string], delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean], localeSensitive=[boolean], callback=[any])

Sorts a string and returns the result

Arguments:

trim()

Trim whitespace from the beginning and end of a string

lTrim()

Trim leading whitespace from a string

uCFirst(doAll=[boolean], doLowerIfAllUppercase=[boolean])

Transform the first letter of a string to uppercase or the first letter of each word, and optionally lowercase uppercase characters.

Arguments:

find(substring=[string], start=[integer])

Finds the first occurrence of a substring in a string, from a specified start position.

Arguments:

findNoCase(substring=[string], start=[integer])

Finds the first occurrence of a substring in a string, from a specified start position.

Arguments:

reMatch(reg_expression=[string])

Uses a regular expression (RE) to search a string for a pattern, starting from a specified position.

Arguments:

reMatchNoCase(reg_expression=[string])

Uses a regular expression (RE) to search a string for a pattern, starting from a specified position.

Arguments:

lJustify(length=[integer])

Justifies characters in a string of a specified length, either left or right.

Arguments:

rJustify(length=[integer])

Justifies characters in a string of a specified length, either left or right.

Arguments:

left(count=[integer])

Extract the leftmost count characters from a string

Arguments:

uCase()

Uppercase a string

listReduce(callback=[function:BiFunction], initialValue=[any], delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean])

Run the provided udf over a delimited list to reduce the values to a single output

Arguments:

yesNoFormat()

Return Yes/No based on whether the input is true/false

replaceNoCase(substring1=[string], obj=[string], scope=[string])

Replaces occurrences of substring1 in a string with obj, in a specified scope.

The search is case-sensitive. Function returns original string with replacements made

Arguments:

removeChars(start=[integer], count=[integer])

Removes characters from a string.

Arguments:

rTrim()

Trim trailing whitespace from a string

charsetDecode(encoding=[string])

Encodes a string to a binary representation

Arguments:

stringSome(callback=[function:Predicate], delimiter=[string], includeEmptyFields=[boolean], multiCharacterDelimiter=[boolean], parallel=[boolean], maxThreads=[integer])

Tests whether any item in a string meets the specified callback

Arguments:

sQLPrettify()

Prettify a SQL string

toStruct(delimiter=[string])

Convert a query string to a struct.

Each key-value pair in the query string is separated by a delimiter. The default delimiter is ,{@code "&"}, ,

, Example:

,

,
queryStringToStruct( "foo=bar,&,baz=qux" );
"foo=bar,&,baz=qux".toStruct();
,

Arguments:

mid(start=[integer], count=[integer])

Extract a substring from a string

Arguments:

lCase()

Uppercase a string

paragraphFormat()

Replaces characters in a string: Single newline characters (CR/LF sequences) with spaces and double newline characters with HTML paragraph tags

Examples

Last updated

Logo

Copyright & Register Trademark by Ortus Solutions, Corp & Ortus Software, LLC