ASCII to Integer

Classification Images
Name:
ASCII to Integer

Symbol:
ATOI
Appearance:  

Appearance.
Group:
Converters

CannyLab version:
from 1.8
Icon:

Icon.
Inputs
Input Value
Characters 1 & 0: A pair of ASCII characters
Characters 15 & 14: A pair of ASCII characters
Base:: Integer
Outputs
Output Value
Число: Integer

General description

Converts the string representation of a number for a given base 2, 10 or 16 into a numeric value.

The original string must contain valid characters in the selected numeral system on the positions: 0..15, 11..15 or 12..15 for a given base 2, 10 and 16, respectively.

Features

Symbols, which set outside of these position ranges, discarded.

In case of invalid characters presence on inputs, the value of the output will be set to 0.

In the case of using an invalid base, value output value will be set to 0.

Examples

«0101101110100000» base 2 = 23456.
«0000000000123456» base 10 = 23456 (symbol “1” is suppressed).
«00000000000F5Ba0» base 16 = 23456 (symbol “F” is suppressed)).
«0000000000005BG0» base 16 = 0 (incorrect symbol “G”).

Notes

With the release of CANNY Lab version 1.8 a new data presentation added - “A pair of characters” in which the values are represented by two characters ASCII with the codes given by high and low bytes of displaying 16-bit value .

For example, the decimal number 19778 corresponding hexadecimal 0x4B4E, displayed a pair of characters «KN», having ASCII-code 0x4B, and 0x4E respectively.

SEE ALSO