ocean.text.convert.Integer

A set of functions for converting strings to integer values.

This module is adapted from ocean.text.convert.Integer_tango. The functions have been modified so that they do not throw exceptions, instead denoting errors via their bool return value. This is more efficient and avoids the tango style of always throwing new Exceptions upon error.

Members

Functions

floatStringToInt
bool floatStringToInt(cstring float_str, T value, size_t decimal_points)

Parses a floating point number represented as a string directly to an integer value.

toByte
bool toByte(T[] digits, byte value, uint radix)
toInt
bool toInt(T[] digits, int value, uint radix)

Parse an integer value from the provided string.

toInteger
bool toInteger(C[] digits, T value, uint radix)

Parse an integer value from the provided string. The exact type of integer parsed is determined by the template parameter T (see below).

toLong
bool toLong(T[] digits, long value, uint radix)
toShort
bool toShort(T[] digits, short value, uint radix)
toUbyte
bool toUbyte(T[] digits, ubyte value, uint radix)
toUint
bool toUint(T[] digits, uint value, uint radix)
toUlong
bool toUlong(T[] digits, ulong value, uint radix)
toUshort
bool toUshort(T[] digits, ushort value, uint radix)

Parse an integer value from the provided string.

Meta

License

Tango Dual License: 3-Clause BSD License / Academic Free License v3.0. See LICENSE_TANGO.txt for details.

Version

Initial release: Nov 2005 Ocean adaptation: July 2012

Authors

Kris Bell, Gavin Norman