EasyManua.ls Logo

Crestron SIMPL+ - SIMPL+ Data Conversion Functions; Data Conversion Functions Overview; Atoi Function

Crestron SIMPL+
374 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Crestron SIMPL+
®
Software
Language Reference Guide - DOC. 5797G SIMPL+
®
z 109
Data Conversion Functions
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

Table of Contents

Other manuals for Crestron SIMPL+

Related product manuals