String

The following is a list of the String functions. Click the links for further information.

Asc(Char a)

This function evaluates the ASCII value of the first character of the argument.

Parameter

a - A Char value.

Return value

The return value is an Integer.

Example

The return value of the following statement is 97.

Asc("abc")

ByteToText(byte)

This function will return the size of a message in the "appropriate" unit.

Parameter

Byte is the size of a message in bytes.

Return value

String.

Examples

Chr(Integer a)

This function returns a single character string associated with the ASCII value passed as the argument.

Parameter

a - A BigInt value.

Return value

The return value is a String.

Examples

ExchGetId (address)

This function will begin by determining whether the address is in X500 or X400 format. Once this has been ascertained, the function will then determine the ID.

Note: The fields must follow the address type standards for the functions to operate them.

Parameter

address - The address of sender/recipient (String data type).

Return value

String value.

Examples

ExchGetOrganization(address)

This function will begin by determining whether the address is in X500 or X400 format. Once this has been ascertained, the function will then determine the Organization Name.

Note: The fields must follow the address type standards for the functions to operate on them.

Parameter

address - The address of the sender/recipient (String data type).

Return value

String value.

Examples

ExchGetPath(path)

This function will return the container information in an address field.

Parameter

path - The address of sender/receiver (String data type).

Examples

ExchGetSite(address)

The function will begin by determining whether the address is in X500 or X400 format. Once this has been ascertained, the function will then determine the Site Name.

Note: The fields must follow the address type standards for the functions to operate on them.

Parameter

address - The address of sender/recipient (String data type).

Return value

String value.

Examples

ExtractString(String origin, String start, String end)

This function is used to evaluate an origin string and returns the first occurrence of a String that starts with the Start String and ends with the End String (the End String is excluded). If the End String is not found, the string that starts with the Start String till its end will be returned.

Parameters

Return value

The return value is a String.

Examples

filter(inString, searchString)

This function is designed to search the string in the specified strings. It searches an array of strings for a specified string, and returns the strings in an array.

Overloads

Parameters

Return value

Array of String values.

Examples

Suppose that inString = [ "abc", "Abc", "abcdfg", "asdfabc", "sdfdfd"], searchString = "abc"

InStr()

InStr(String a, String b)

This function returns the position of the first occurrence of one string within another. If String a is not found in String b, the InStr function will return -1.

Parameters

Return value

The return value is an Integer.

Examples

InStr(Number a, String b, String c)

This function returns the position of the first occurrence of one string within another, starting at the position specified by argument a. If String c is not found in String b, the InStr function will return -1.

Parameters

Return value

The return value is an Integer.

Examples

join(stringArray)

Returns a string created by joining a number of substrings contained in an array.

Overloads

Parameters

Return value

String value.

Examples

Assume that the stringArray list in the examples consists of the following three elements: Welcome, Use and JReport.

LastIndexOf()

LastIndexOf(String a, String b)

This function returns the position of the last occurrence of one string within another, if String b is not found in String a, the InStr function will return -1.

Parameters

Return value

The return value is an Integer.

Examples

LastIndexOf(BigInt a, String b, String c)

This function returns the position within this string of the first occurrence of the specified substring, searching backward starting at the position specified by argument a. If String c is not found in String b, the InStr function will return -1.

Parameters

Return value

The return value is an Integer.

Left(String a, Number b)

This function returns a substring that contains the specified number of characters from the left side of a string.

Parameters

Return value

The return value is a String.

Example

The return value of the following statement is he is.

Left("he is my father", 5)

Length(String a)

This function returns the number of characters in a String.

Parameter

a - A String value.

Return value

The return value is an Integer.

Example

The return value of the following statement is 16.

Length("she is my mother")

LooksLike(String a, String b)

This function enables you to locate field values using standard DOS wildcards ( ? is a wildcard for a single character, * is a wildcard for any number of characters). It does this by comparing a String to a mask which contains one or more wildcards. The function returns True if the string matches the mask, and False if the string does not match the mask.

Parameters

Return value

The return value is True or False.

Examples

LowerCase(String a)

This function returns a String that contains all lowercase letters converted from String a.

Parameter

a - A String value.

Return value

The return value is a String.

Example

The return value of the following statement is this is her book.

LowerCase("This is HER book")

Mid()

Mid(String a, Number b)

This function returns a number of characters from a specified position of a String.

Parameters

Return value

The return value is a String.

Example

The return value of the following statement is my father.

Mid("he is my father", 6)

Mid(String a, BigInt b, BigInt c)

This function returns a specified number of characters from a specified position of a String.

Parameters

Return value

The return value is a String.

Examples

NumericText(String a)

This function is used to test if the content of the string is a Number.

Parameter

a - A String value to be tested.

Return value

The return value is Boolean.

Examples

Picture(String a, String b)

This function prints a string or values in a string in a predetermined format.

Parameters

Return value

The return value is a string.

Examples

ProperCase()

Capitalizes the first letter in a text string and any other letter that follows a character other than a letter, and converts all other letters to lowercase letters.

Overloads

ProperCase(String)

Parameter

String - A text string.

Return value

String value.

Examples

ReplaceString(inString, searchString, replaceString, startPosition, count, compare)

Returns a String in which a specified substring has been replaced with another substring a specified number of times. As an option, you can also specify a location in the string where the replacing process will begin from (returns a string starting from that position). This function is typically used in a string to systematically replace one substring with another.

Overloads

Parameters

Return value

String value.

Examples

Assume that inStrings = "abc Abc abcdfg asdfabc sdfdfd", searchString = "abc", replaceString = "ABC".

Note: The return value of the replace function is a String, with the specified substring replacements made, beginning at the position specified by startPosition, and endings at the end of the inString string. It is not a start to finish copy of the original string.

ReplicateString(String a, Integer b)

This function replicates the string in String a the number of times specified by b.

Parameters

Return value

The return value is a String.

Example

The return value of the following statement is Stop! Stop! Stop!.

ReplicateString("Stop!", 3)

Right(String a, Integer b)

This function is used to extract the specified number of characters in String a from the right side.

Parameters

Return value

The return value is a String.

Example

The return value of the following statement is mother.

Right("She is my mother", 6)

Soundex(string)

Evaluates a text string and returns a four-character value that symbolizes the way the string sounds. Use this function whenever you want to locate records based on two or more field values that are spelled differently yet sound alike. This function can also be used to find customer names that have been misspelled.

Parameter

String is one of two or more strings that sound alike.

Return value

Text string.

Examples

Notes:

Space(Integer a)

This function returns a String value that contains a specified number of spaces.

Parameter

a - A BigInt value indicating the number of spaces.

Return value

The return value is a String.

Example

The return value of the following statement is   .

Space(3)

StrCmp(String a, String b)

This function is used to compare two strings. It returns positive if String a is greater than String b, returns 0 if String a is equal to String b, and returns negative if String a is less than String b.

Parameters

Return value

The return value is an Integer.

Examples

StringSplit(inString, delimiterString, count, compare)

This function takes a String that contains a number of substrings, breaks it up into a specified number of substrings and returns an array containing the substrings.

Overloads

Parameters

Return value

Array of String values.

Examples

Assume that inString = "Welcome use JReport"

Note: If count, c, is less than the total number of substrings in inString, then at most c substrings will be returned as elements in the resultant array. The last element in the array is a concatenation of the substring and all the remaining substrings.

strReverse(inString)

This function is designed to reverse the string. It returns a String in which the character order of inString is reversed. If inString is a zero-length string (" "), a zero-length string will be returned.

Parameter

inString - A String whose characters are to be reversed.

Return value

String value.

Examples

toLongString(String a)

This function converts a string to a long string.

Parameter

a - A String value.

Return value

The return value is a LongString.

Example

The return value of the following statement is aa.

LongString a=toLongString("aa");
string b="bb";
if (b > toString(a)) then
return a
else
return toLongString(b);

ToNumber()

ToNumber(Currency a)

This function converts a Currency to a Number.

Parameter

a - A Currency value.

Return value

The return value is a Number.

Examples

ToNumber(String a)

This function converts a specified string to a Number.

Parameter

a - A Char value.

Return value

The return value is a Number.

Example

The return value of the following statement is 123.00.

ToNumber("123")

Note: In this function, the format of the string should be [#] or [#].[#]. If you input a character string as the argument, the return value will be NULL.

toString(LongString a)

This function converts a long string to a string.

Parameter

a - A LongString value.

Return value

The return value is a String.

Examples

The return value of the following statement is aa.

LongString a=toLongString("aa");
string b="bb";
if (b > toString(a)) then
return a
else
return toLongString(b);

ToText()

ToText(Bit a)

This function converts a Bit value to a String, either true or false.

Parameter

a - A Bit value.

Return value

The return value is a String.

Example

The return value of the following statement is false.

ToText(3<2)

ToText(Currency a)

This function converts a Currency value to a String.

Parameter

a - A Currency value to be converted.

Return value

The return value is a String.

Example

The return value of the following statement is $123.45.

ToText($123.45)

ToText(Currency a, String b)

This function converts a Currency value to a String.

Parameters

Return value

The return value is a String.

Example

The return value of the following statement is $123.45.

ToText($123.45, "$##0.00")

ToText(Currency a, String b, Integer c)

This function converts a Currency value to a String.

Parameters

Return value

The return value is a String.

Example

The return value of the following statement is $123.5.

ToText($123.456, "$##0.00", 1)

ToText(Currency a, String  b, Integer c, String d)

This function converts a Currency value to a String.

Parameters

Return value

The return value is a String.

Example

The return value of the following statement is $1*234.57.

ToText($1234.57, "$#,###.000", 2, "*")

ToText(Currency a, String b, Integer c, String d, String e)

This function converts a Currency value to a String.

Parameters

Return value

The return value is a String.

Examples

ToText(Currency a, Integer c)

This function converts a Currency value to a String.

Parameters

Return value

The return value is a String.

Example

The return value of the following statement is $123.46.

ToText($123.4567, 2)

ToText(Currency a, Integer c, String d)

This function converts a Currency value to a String.

Parameters

Return value

The return value is a String.

Example

The return value of the following statement is $1,234.57.

ToText($1234.567, 2, ",")

ToText(Currency a, Integer c, String d,String e)

This function converts a Currency value to a String.

Parameters

Return value

The return value is a String.

Example

The return value of the following statement is $1,234.57.

ToText($1234.567, 2, ",", ".")

ToText(Date a)

This function converts a Date value to a String.

Parameter

a - A Data value.

Return value

The return value is a String.

Example

Suppose the date is July 15,1999, the return value of the following statement is 15-Jul-99.

ToText(ToDate(1999,7,15))

ToText(Date a, String b)

This function converts a Date value to a String.

Parameters

Return value

The return value is a String.

Example

Suppose the date is July 15,1999, the return value of the following statement is 15-Jul-99.

ToText(ToDate(1999,7,15), "dd-MMM-yy")

ToText(DateTime a)

This function converts a DateTime value to a String.

Parameter

a - A TimeStamp value to be converted.

Return value

The return value is a String.

Example

Suppose the date is July 15,1999 and time is 7:42:51, the return value of the following statement is 15-Jul-99 7:42:51 AM.

ToText(ToDateTime(1999,7,15,7,42,51))

ToText(DateTime a, String b)

This function converts a DateTime value to a String.

Parameters

Return value

The return value is a String.

Example

Suppose the date is July 15,1999 and time is 7:42:51, the return value of the following statement is 07-15-99 7:42:51.

ToText(ToDateTime(1999,7,15,7,42,51), "MM-dd-yy h:mm:ss")

ToText(DateTime a, String b, String c)

This function converts a DateTime value to a String.

Parameters

Return value

The return value is a String.

Example

Suppose the date is July 15,1999 and time is 7:42:51, the return value of the following statement is 15-Jul-99 7:42:51 AM.

ToText(ToDateTime(1999,7,15,7,42,51), "dd-MMM-yy h:mm:ss a", "AM")

ToText(DateTime a, String  b, String c, String d)

This function converts a DateTime value to a String.

Parameters

Return value

The return value is a String.

Examples

ToText(Integer a)

This function converts a BigInt value to a String.

Parameter

a - A BigInt value to be converted.

Return value

The return value is a String.

Example

The return value of the following statement is 456.

ToText(456)

ToText(Integer a, String b)

This function converts a BigInt value to a String.

Parameters

Return value

The return value is a String.

Example

The return value of the following statement is 456.

ToText(456, "###")

ToText (Integer a, String b, Integer c)

This function converts a BigInt value to a String.

Parameters

Return value

The return value is a String.

Example

The return value of the following statement is 456.00.

ToText(456, "###", 2)

ToText(Integer a, String b, Integer c, String d)

This function converts a BigInt value to a String.

Parameters

Return value

The return value is a String.

Example

The return value of the following statement is 1,234.00.

ToText(1234, "#,###", 2, ",", ".")

ToText(Integer a, String b, Integer c, String d, String e)

This function converts a BigInt value to a String.

Parameters

Return value

The return value is a String.

Example

The return value of the following statement is 1,234.00.

ToText(1234, "#,###", 2, ",", ".")

ToText(Integer a, Integer c)

This function converts a BigInt value to a String.

Parameters

Return value

The return value is a String.

Example

The return value of the following statement is 123.00.

ToText(123, 2)

ToText(Integer a, Integer c, String d)

This function converts a BigInt value to a String.

Parameters

Return value

The return value is a String.

Example

The return value of the following statement is 1,234.00.

ToText(1234, 2, ",")

ToText(Integer a, Integer c, String d, String e)

This function converts a BigInt value to a String.

Parameters

Return value

The return value is a String.

Example

The return value of the following statement is 12,345.00.

ToText(12345, 2, ",", ".")

ToText(Number a)

This function converts a Double value to a String.

Parameter

a - A Double value to be converted.

Return value

The return value is a String.

Example

The return value of the following statement is 123.456.

ToText(123.456)

ToText(Number a, String b)

This function converts a Double value to a String.

Parameters

Return value

The return value is a String.

Example

The return value of the following statement is 1236.46.

ToText(1236.456, "###0.00")

ToText(Number a, String b, Integer c)

This function converts a Double value to a String.

Parameters

Return value

The return value is a string.

Example

The return value of the following statement is 123.46.

ToText(123.456, "###.00", 2)

ToText(Number a, String b, Integer c, String d)

This function converts a Double value to a String.

Parameters

Return value

The return value is a String.

Example

The return value of the following statement is 1,234.57.

ToText(1234.567, "#,###.000", 2, ",")

ToText(Number a, String b, Integer c, String d,String e)

This function converts a Double value to a String.

Parameters

Return value

The return value is a String.

Example

The return value of the following statement is 1,234.57.

ToText(1234.567, "#,###.000", 2, ",", ".")

ToText(Number a, Integer c)

This function converts a Double value to a String.

Parameters

Return value

The return value is a String.

Example

The return value of the following statement is 123.46.

ToText(123.456, 2)

ToText(Number a, Integer c, String d)

This function converts a Double value to a string.

Parameters

Return value

The return value is a String.

Example

The return value of the following statement is 1,234.6.

ToText(1234.567, 1, ",")

ToText(Number a, Integer c, String d, String e)

This function converts a Double value to a String.

Parameters

Return value

The return value is a String.

Example

The return value of the following statement is 1,234,57.

ToText(1234.567, 2, "," , ",")

ToText(Time a)

This function converts a Time value to a String.

Parameter

a - A Time value.

Return value

The return value is a String.

Example

Suppose the time is 12:40:30, the return value of the following statement is 12:40:30 PM.

ToText(ToTime(12,40,30))

ToText(Time a, String b)

This function converts a Time value to a String.

Parameters

Return value

The return value is a String.

Example

Suppose the time is 08:48:58, the return value of the following statement is 8:48:58.

ToText(ToTime(8,48,58), "h:mm:ss")

ToText(Time a, String b, String c)

This function converts a Time value to a String.

Parameters

Return value

The return value is a String.

Example

Suppose the time is 8:48:58 in the morning, the return value of the following statement is 8:48:58 AM.

ToText(ToTime(8,48,58), "h:mm:ss a", "AM")

ToText(Time a, String b,String c, String d)

This function converts a Time value to a String.

Parameters

Return value

The return value is a String.

Examples

Notes:

ToWords()

ToWords(Currency a)

This function converts a Number field value or the result of a numeric calculation to words.

Parameter

a - A Currency value to be converted into words.

Return value

The return value is a String.

Example

The return value of the following statement is three and 15/100.

ToWords($3.15)

ToWords(Currency a, Integer b)

This function converts a Number field value or the result of a numeric calculation to words.

Parameters

Return value

The return value is a String.

Example

The return value of the following statement is three and 5/10.

ToWords($3.45, 1)

ToWords(Integer a)

This function converts a Number field value or the result of a numeric calculation to words.

Parameter

a - A BigInt value to be converted into words.

Return value

The return value is a String.

Example

The return value of the following statement is twenty and xx/100.

ToWords(20)

ToWords(Integer a, Integer b)

This function converts a Number field value or the result of a numeric calculation to words.

Parameters

Return value

The return value is a String.

Example

The return value of the following statement is three and x/10.

ToWords(3, 1)

ToWords(Number a)

This function converts a Number field value or the result of a numeric calculation to words.

Parameter

a - A fractional number to be converted into words.

Return value

The return value is a String.

Example

The return value of the following statement is ten and 12/100.

ToWords(10.12)

ToWords(Number a, Integer b)

This function converts a Number field value or the result of a numeric calculation to words.

Parameters

Return value

The return value is a String.

Example

The return value of the following statement is three and 1/10.

ToWords(3.14, 1)

Trim(String a)

This function is used to remove the leading and the trailing spaces from string arguments.

Parameter

a - A String value.

Return value

The return value is a String.

Example

The return value of the following statement is he is a boy.

Trim("he is a boy")

TrimLeft(String a)

This function is used to remove the spaces on the left side of the string.

Parameter

a - A String value to be trimmed.

Return value

The return value is a String.

Example

The return value of the following statement is he is a boy.

TrimLeft("he is a boy")

TrimRight(String a)

This function is used to remove the spaces on the right side of the string.

Parameter

a - A String value to be trimmed.

Return value

The return value is a String.

Example

The return value of the following statement is he is a boy.

TrimRight("he is a boy")

UpperCase(String a)

This function converts all letters in string a to uppercase letters.

Parameter

a - A String value.

Return value

The return value is a String.

Example

The return value of the following statement is HE IS A BOY.

UpperCase("he is a boy")

Val(String a)

This function reads a string containing numbers (e.g. address, phone or social security number), and converts them to a decimal value. Val stops reading when it finds the first character in the string.

Parameter

a - A String value.

Return value

The return value is a Number.

Example

The return value of the following statement is 63,550,513.00.

Val("63550513Mr.Tom")