Crestron SIMPL+
Data Conversion Functions
Language Reference Guide - DOC. 5797G
®
Data Conversion Functions Overview
These functions take one form of data (integer or string) and convert it to the opposite
type in a given SIMPL+ program. Usually, these functions are for converting number
stored in strings to integers, or for converting numbers stored in integers to strings.
Atoi
Name:
Atoi
Syntax:
INTEGER Atoi(STRING SOURCE);
Description:
Converts a STRING to an INTEGER value. The conversion looks for the first valid
character (0-9), and then reads until it finds the first invalid character. The resulting
string of valid characters is then converted. The "-" is ignored, hence the output is an
unsigned number [i.e., ATOI("-1") would yield 1 as the output]. If the value exceeds
65535, the value is undefined. If no valid value to convert is found, 0 is returned.
Parameters:
SOURCE is a string containing characters that range from 0 to 9 to be converted.
Return Value:
An integer representing the given string value. Example:
STRING_INPUT IN$[100];
INTEGER VAL;
CHANGE IN$
{
VAL = ATOI(IN$);
PRINT("Value of %s after ATOI is %d\n", IN$, VAL);
}
For example, if IN$ is "abc1234xyz", then VAL will hold the integer 1234. If IN$ is
"-50", then VAL will hold the integer 50.
Version:
SIMPL+ Version 1.00
Software
®
SIMPL+
109
Need help?
Do you have a question about the SIMPL+ and is the answer not in the manual?
Questions and answers