The OpenD Programming Language

arsd.conv

A simplified version of std.conv with better error messages and faster compiles for supported types.

Members

Classes

StringToIntConvException
class StringToIntConvException
ValueOutOfRangeException
class ValueOutOfRangeException

Functions

checkedConversion
T checkedConversion(long value, long minimumAcceptableValue, long maximumAcceptableValue)
T checkedConversion(ulong value, ulong minimumAcceptableValue, ulong maximumAcceptableValue)

Converts two integer types, throwing an exception if the given value is out of range for it.

saturatingConversion
T saturatingConversion(long value)

Converts two integer types, returning the min/max of the desired type if the given value is out of range for it.

stringToInt
long stringToInt(const(char)[] str, StringToIntArgs args)

if radix is 0, guess from 0o, 0x, 0b prefixes.

to
T to(const(char)[] str)

Converts a string into the other given type. Throws on failure.

to
string to(From value)

Converts any given value to a string. The format of the string is unspecified; it is meant for a human reader and might be overridden by types.

truncatingConversion
T truncatingConversion(long value)

Truncates off bits that won't fit; equivalent to a built-in cast operation (you can just use a cast instead if you want).

Structs

StringToIntArgs
struct StringToIntArgs

if radix is 0, guess from 0o, 0x, 0b prefixes.

Meta

History

Added May 22, 2025