Spreadsheet Formulas - Text Functions

Statistica provides a predefined broad selection of text functions that can be used in spreadsheet formulas like all other functions.

Below is a list of all available text spreadsheet functions (parameters are given in parentheses).
 

Contains(text, subtext)

Returns the character position of subtext in text, or 0 if not found.

Contains("This is a test ", "tes") evaluates as 11

Contains("Hello Harold", "H") evaluates as 1

Contains("ABC", "X") evaluates to 0

Hex

Converts text to string containing the hexadecimal codes for each character. For numeric arguments, truncates to 32 bit integers and returns the corresponding hex value as a string. For example:

Hex("A") returns the string H41

Hex("AB") returns H4142

Hex(16) returns the string H00000010

Item (i, text [, delimiters])

Returns the ith word in text. Words are delimited by spaced, or any of the characters in optional delimiters parameter. Adjacent delimiters count as separate delimiters with empty words between. For example,

Item(2, "Newton, Isaac", ", ") is the empty string between the comma and the space.

LabelOf(x)

Return text label of variable

LCase(x)

Return text in lowercase

Len(string)

Get string length

Mid (string, start_index, length)

Returns a specified number of characters from a string

Munger(search_text,offset,find_length [, replace])

Finds substrings, insert or delete substrings. The first argument, search-text, will contain the text to search. The second argument, offset, is the one-based numeric offset into search-text at which to begin the search. The third argument, find-or-length, is a text or numeric expression. For example,

MUNGER("Hello", 1, 2)  "He" (substring from position 1 with length 2)

MUNGER("ABBA", 3, "B")  3 (index of first "B" at or after position 3)

MUNGER("Today and tomorrow", 1, "and", "or")  "Today or tomorrow"

Repeat(text,count)

Returns a string consisting of count copies of text. For example:

Repeat("Angie", 2) creates AngieAngie.

StrComp(x1,x2)

Compare 2 strings

StrIComp(x1,x2)

Compare 2 strings case insensitive

ToNumber(x)

Convert string to number

ToNumberEx(x, "0.000")

Convert string to number

ToString(x)

Convert number to string

ToStringEx(x, "0.000")

Convert number to string with parser.

Trim(text)

Removes trailing blanks from text. For example:

trim("hello  ") evaluates as "hello"

UCase(x)

Convert argument to upper case.

Word(i, text [, delimiters])

Returns the ith word in text. Words are delimited by spaced, or any of the characters in optional delimiters parameter. Adjacent delimiters count as one delimiter. For example:

Word(2, "Ayn Rand") returns "Rand"

Word(1, "Rand, Ayn", ", ") returns "Rand"

Word(1, "Rand, Ayn", ", ")  specifies that either a comma or a space is a delimiter

See also: Distributions and their Functions, Spreadsheet Formulas - Overview, Spreadsheet Formulas - Syntax Summary, Spreadsheet Formulas - Examples, Spreadsheet Formulas - Syntax Operators, Spreadsheet Formulas - Distributions and their Functions.