std.itoa

STRINGstd.itoaINTEGERvalueINTEGERbase

Available inall subroutines.

Converts the integer value to a string in the given base.

The base value defaults to 10 (decimal) and can range from 2 to 36 (inclusive).

Base prefixes, such as hexadecimal (0x) and octal (0), are not included.

The character set used is 0123456789abcdefghijklmnopqrstuvwxyz (0-9a-z).

Errors

If the base argument is less than 2 or greater than 36, then fastly.error will be set to EINVAL.

Example

# decimal: "-10"
std.itoa(-10)
# hexadecimal: "2a"
std.itoa(42, 16)

User contributed notes

BETA

Do you see an error in this page? Do have an interesting use case, example or edge case people should know about? Share your knowledge and help people who are reading this page! (Comments are moderated; for support, please contact support@fastly.com)