String functions




uAsc, uUnicode

Description

Returns a Unicode character value of the first character. With the optional parameter index, you can also return the code for a different character in the string. The index parameter starts at 1.

Syntax

number uAsc(value, index)

Parameters

string value

An input string.

number index

Character position for reading ASCII value.

Examples

Example 1

To get a Unicode value from a string:

uAsc("Big Ben")      // returns 66
uAsc("Big Ben", 2)  // returns 105



uChr, uUniChr

Description

Similar to the common chr function but returns the Unicode character specified by the number given. In addition you can also specify more than one character and unicode escape sequences in order to create a string.

Syntax

string uChr(params, ...)

Parameters

params

A list of expressions or values.

Examples

Example 1

To create a Unicode string from char values:

What you will see:

uChr(64) // returns "@"
uChr("\u0064\u006f\u0067")  // returns "dog"
uChr(65, "pple ")  // returns "apple"



uCap

Description

Returns the capitalized representation of a string. In other words, the first letter of each and every word in the string is capitalized.

Syntax

string uCap(text )

Parameters

input text

The string to be capitalized.

Examples

Example 1

To capitalize a string:

uCap(‘fArmeR, ASTROnaut’) // returns ‘Farmer, Astronaut’
uCap(‘the first weekend’) // returns ‘The First Weekend’



uConcat, uCon

Description

Returns the concatenation of all input parameters.

Syntax

string uConcat(params, ...)

Parameters

params

A list of expressions or values of any datatype.

Examples

Example 1

To concatenate a string:

uConcat(“For “, 3, “ years.”) returns “For 3 years.”



uJoin

Description

Concatenates a delimited string respecting NULL values. All parameters are concatenated using the value in the first parameter as delimiter. If the second parameter is not zero, empty parameters are treated as normal; otherwise, they are ignored.

Error codes: none

Syntax

string uJoin(delimiter, allowEmpty, params, ...)

Parameters

string delimiter

Delimiter to be used between all other string parts.

number allowEmpty

Flag (0/1) indicating if we allow empty fields.

string params

List of strings to concatenate.

Examples

Example 1

To create a delimited string:

uJoin("-", 1, "James", "", "Tiberius", "Kirk") // returns "James--Tiberius-Kirk"
uJoin("-", 0, "James", "", "Tiberius", "Kirk") // returns "James-Tiberius-Kirk"



uLeft

Description

Returns the leftmost N characters from a string

Syntax

string uLeft(input, chars)

Parameters

string input

The input string.

number chars

The amount of characters to be retrieved.

Examples

Example 1

To get the leftmost part of a string:

uLeft("James T. Kirk", 5)  // returns "James"
uLeft(null, 5) // returns null



uLength, uLen

Description

Returns the length of a string

Syntax

String uLength(input)

Parameters

string input

The input string.

Examples

Example 1

To get the length of a string:

uLength("James T. Kirk")  // returns 13



uSubstr, uMid

Description

Returns a part of a string starting at a character position with a length of length.

Syntax

string uSubstr(input, position, length)

Parameters

string input

The input string.

number position

The position where to start reading.

number length

The number of characters to read.

Examples

Example 1

To get a substring out of a string:

uSubstr("James T. Kirk", 7, 2)       // returns "T."



uLPos

Description

Returns the position of a substring within a string. A result of zero indicates that the substring has not been found

Syntax

string uLPos(input, substring)

Parameters

string input

The input string.

string substring

The substring to search.

Examples

Example 1

To find the first occurrence of a substring:

uLPos("James T. Kirk", "T")   //returns 7



uLower, uLow

Description

Returns the input string in lowercase letters.

Syntax

string uLower(input);
string input;

Parameters

string input

The input string.

Examples

Example 1

To convert a string into lowercase letters:

uLower(“James T. Kirk”) // returns “james t. kirk”



uLStuff

Description

Fills the left side of a string up to a specified length. By default, the string is stuffed with spaces (ASCII 32).

Syntax

string uLStuff(input, length, [ stuff)

Parameters

string input

The input string.

number length

New length of string.

string stuff(optional)

String to append, default is an empty space (ASCII 32).

Examples

Example 1

To expand a string by filling its left side:

uLStuff(“3.5”, 5) // returns “ 3.5”
uLStuff(“3.5”, 5, 5, “0”) // returns “0003.5”



uLTrim

Description

Removes characters from the left side of the string. If the second parameter is omitted, it defaults to space (ASCII 32).

Syntax

string uLTrim(input, trimstring)

Parameters

string input

The input string.

string trimstring

The string to trim.

Examples

Example 1

To trim a string on the left side:

uLTrim("  3.5")       // returns "3.5"
uLTrim("003.5", "0")  // returns "3.5"



uRepeat

Description

Returns the given string repeated N times.

Syntax

string uRepeat(input, repeats)

Parameters

string input

The string to be repeated.

number repeats

The number of times to repeat the input string.

Examples

Example 1

To repeat a string multiple times:

uRepeat("Hello ", 4)  // returns "Hello Hello Hello Hello "



uReplace

Description

Replaces parts of a string.

Syntax

string uReplace(input, search, replace)

Parameters

string input

The string to worked on.

string search

The pattern to be searched.

string replace

The string that will replace any match.

Examples

Example 1

To search and replace patterns of a string:

uReplace("At four o' clock he became four", "four", "4")  // returns "At 4 o' clock he became 4"



uReverse

Description

Reverses a string.

Syntax

string uReverse(input)

Parameters

string input

The string to reverse.

Examples

Example 1

To search and replace patterns of a string:

uReverse("Smith”)  // returns "htimS”



uRight

Description

Returns the rightmost N characters from a string.

Syntax

string uRight(input, chars)

Parameters

string input

The input string.

number chars

The number of chars to be read.

Examples

Example 1

To get the rightmost part of a string:

uRight("James T. Kirk", 4)  // returns "Kirk"
uRight(null, 5) / / returns null



uRPos

Description

Returns the position of a substring within a string. A result of zero indicates that the substring has not been found.

Syntax

string uRPos(input, substring)

Parameters

string input

The input string.

string substring

The substring to find.

Examples

Example 1

To find the last occurrence of a substring:

uRPos("James T. Kirk", "T")   //returns 7



uRStuff

Description

Fills the right side of a string up to specified length. By default, the string is stuffed with spaces (ASCII 32).

Syntax

string uRStuff(input, length, stuffstring)

Parameters

string input

The input string.

number length

The new length of the result string.

string stuffstring

The string to append.

Examples

Example 1

To expand a string by filling its right side:

uRStuff("3.5", 5)       // returns "3.5  "
uRStuff("3.5", 5, "0")  // returns "3.500"



uRTrim

Description

Removes characters from the right side of the string. If the second parameter is omitted, it defaults to spaces (ASCII 32).

Syntax

string uRTrim(input, trimstring)

Parameters

string input

The input string.

string trimstring

The string to trim.

Examples

Example 1

To trim a string on the right side:

uRTrim("3.5  ")       // returns "3.5"
uRTrim("3.500", "0")  // returns "3.5"



uTrim

Description

Removes characters from both sides of the string. If the second parameter is omitted, it defaults to spaces (ASCII 32).

Syntax

string uTrim(input, trimstring)

Parameters

string input

The input string.

string trimstring

The string to trim.

Examples

Example 1

To trim a string on both sides:

uTrim("  3.5  ") // returns "3.5"
uTrim("003.500", "0")  // returns "3.5"



uUpper, uUpp

Description

Returns the input string in uppercase letters

Syntax

string uUpper(input)

Parameters

string input

The input string.

Examples

Example 1

To convert a string into uppercase letters:

uUpper("James T. Kirk")  // returns "JAMES T. KIRK"