SIMPOL Documentation

Conversion Functions

This section contains the intrinsic functions that are used for converting values from one type to another. This includes functions for converting strings to integers or numbers, integers and numbers to strings, integers to characters and characters to integers.

.char()

Prototype

.char( <charval> )

Return types

.nul, .inf, string

Description

Returns a string containing the character with the specified numeric value.

Parameters

charval
Type nameResult for an expression of this type in this parameter
.nul The result will be .nul
.inf The result will be .inf
integer The value to get the character for

.charval()

Prototype

.charval( <text> )

Return types

.nul, .inf, integer

Description

Returns the numeric value of the first character of a string

Parameters

text
Type nameResult for an expression of this type in this parameter
.nul The result will be .nul
.inf The result will be .inf
string The string for which the numeric value of the first character should be returned. If this is the empty string then the return value is .nul.

.deintegerize()

Prototype

.deintegerize( <value> )

Return types

.nul, .inf, string

Description

This converts any non-negative integer into a unique string and is the reverse of .integerize(). If value is equal to .nul or .inf then the result is the same.

Parameters

value
Type nameResult for an expression of this type in this parameter
.nul The result will be .nul
.inf The result will be .inf
(non-negative) integer The integer will be converted to a unique string

.integerize()

Prototype

.integerize( <value> )

Return types

.nul, .inf, integer

Description

This converts any string into a unique non-negative integer and is the reverse of .deintegerize(). If value is equal to .nul or .inf then the result is the same.

Parameters

value
Type nameResult for an expression of this type in this parameter
.nul The result will be .nul
.inf The result will be .inf
string The string will be converted to a unique non-negative integer

.lcase()

Prototype

.lcase( <value> )

Return types

.nul, .inf, string

Description

This function converts a string to lower case. This function supports Unicode version 3.2 including support for special folding characters such as final sigma in Greek. If value is equal to .nul or .inf then the result is the same. Please note that in some situations it is possible for a string to grow in length when converted to lower case.

Parameters

value
Type nameResult for an expression of this type in this parameter
.nul The result will be .nul
.inf The result will be .inf
string The string will be converted to lower case.

.tcase()

Prototype

.tcase( <value> )

Return types

.nul, .inf, string

Description

This function converts a string to title case. This function supports Unicode version 3.2 including support for special folding characters such as final sigma in Greek. If value is equal to .nul or .inf then the result is the same. Please note that in some situations it is possible for a string to increase or decrease in length when converted to title case.

Parameters

value
Type nameResult for an expression of this type in this parameter
.nul The result will be .nul
.inf The result will be .inf
string The string will be converted to title case.

.toblob()

Prototype

.toblob( <string> )

Return types

.nul, .inf, blob

Description

Represents a string value as a blob.

Parameters

value
Type nameResult for an expression of this type in this parameter
.nul The result will be .nul
.inf The result will be .inf, unless the second parameter is .nul or .inf
string The string value to represent as a blob

.tostr()

Prototype

.tostr( <value> , <base> )

Return types

.nul, .inf, string

Description

Represents a numeric value as a string.

Parameters

value
Type nameResult for an expression of this type in this parameter
.nul The result will be .nul
.inf The result will be .inf, unless the second parameter is .nul or .inf
integer The value to represent as a string
number The value to represent as a string. If there is any fractional part then a full stop ('.') is used as a decimal point character. If there is a block of recurring digits then the second copy of this block of digits is placed in square brackets and the string then terminated, for example 1/3 is shown in base 10 as '0.3[3]'. There is no provision for terminating the fractional part if it is very long; trying to represent a number with a large number of digits in the fractional part may raise an error if the string is too long.
base
Type nameResult for an expression of this type in this parameter
.nul The result will be .nul
.inf The result will be .nul
integer The base to use, for example the value 10 specifies a decimal representation. Values less than 2 will cause an error. There is also a platform and version specific upper limit which is not less than 36.

.toval()

Prototype

.toval( <value> , <ignore> , <base> )

Return types

.nul, .inf, integer, number

Description

Converts a string representation of a numeric value into that value, with the option of ignoring some characters. Any invalid characters in the input string will cause an error.

Parameters

value
Type nameResult for an expression of this type in this parameter
.nul The result will be .nul
.inf the result to be .nul
string The string to extract a numeric value from. A full stop ('.') is assumed to be a decimal point character and square brackets are assumed to be used to indicate a recurring block of digits in the fractional part of the number.
ignore
Type nameResult for an expression of this type in this parameter
.nul No characters will be ignored
.inf The result will be .nul
string The characters to be ignored
base
Type nameResult for an expression of this type in this parameter
.nul The result will be .nul
.inf The result will be .nul
integer The base to use, for example the value 10 specifies that the string is to be interpretted as a decimal representation of a numeric value. Values less than 2 will cause an error. There is also a platform and version specific upper limit which is not less than 36.

.ucase()

Prototype

.ucase( <value> )

Return types

.nul, .inf, string

Description

This function converts a string to upper case. This function supports Unicode version 3.2 including support for special folding characters such as final sigma in Greek. If value is equal to .nul or .inf then the result is the same. Please note that in some situations it is possible for a string to increase or decrease in length when converted to upper case.

Parameters

value
Type nameResult for an expression of this type in this parameter
.nul The result will be .nul
.inf The result will be .inf
string The string will be converted to upper case.