Documentation

Format and Conversion

atoi

Description

The atoi() function converts a character string to an integer value.

Syntax

result = atoi (string);

Arguments

stringRequired. Character string that contains the numeric character string to convert to an integer value

Return values

result contains the converted integer value.

Example

In this example, result contains the integer value 123.

result = atoi ("123");

sprintf

Description

The sprintf() function creates a character string by formatting the supplied arguments according to the formatting commands in a format control string. The resulting character string is returned in result.

The format control string controls the formation of the character string that is returned in result. It consists of two types of information: actual content and format command characters. The format command characters are used to insert and format the supplied arguments. The number of format command characters in the format control string must match the number of supplied arguments. In other words, if there are three formatting commands in the format control string, then three function arguments must be supplied. Otherwise, an error is generated.

ℹ️

Note

For more information on format command characters, see Format commands.

Syntax

result = sprintf (controlstring [,expression1, …]);

Arguments

controlstringRequired. Character string that contains the format control string that is used to
generate the formatted string.
expression1 -Optional. Character string and integer values to substitute into the format control string.

Return values

result contains the formatted character string.

Example

In this example, the character string System administrator Ids: Adm1 Adm2 Adm3 is assigned to result.

result = sprintf ("System administrator Ids: %s %s %s", "Adm1", "Adm2", "Adm3");

See also

fprintf, print(), printf, syslog


©2003-2025 BeyondTrust Corporation. All Rights Reserved. Other trademarks identified on this page are owned by their respective owners. BeyondTrust is not a chartered bank or trust company, or depository institution. It is not authorized to accept deposits or trust accounts and is not licensed or regulated by any state or federal banking authority.