Library: Foundation
Package: Core
Header: Poco/NumberParser.h
The NumberParser class provides static methods for parsing numbers out of strings.
Member Functions: parse, parse64, parseFloat, parseHex, parseHex64, parseUnsigned, parseUnsigned64, tryParse, tryParse64, tryParseFloat, tryParseHex, tryParseHex64, tryParseUnsigned, tryParseUnsigned64
static int parse(
const std::string & s
);
Parses an integer value in decimal notation from the given string. Throws a SyntaxException if the string does not hold a number in decimal notation.
static Int64 parse64(
const std::string & s
);
Parses a 64-bit integer value in decimal notation from the given string. Throws a SyntaxException if the string does not hold a number in decimal notation.
static double parseFloat(
const std::string & s
);
Parses a double value in decimal floating point notation from the given string. Throws a SyntaxException if the string does not hold a floating-point number in decimal notation.
static unsigned parseHex(
const std::string & s
);
Parses an integer value in hexadecimal notation from the given string. Throws a SyntaxException if the string does not hold a number in hexadecimal notation.
static UInt64 parseHex64(
const std::string & s
);
Parses a 64 bit-integer value in hexadecimal notation from the given string. Throws a SyntaxException if the string does not hold a number in hexadecimal notation.
static unsigned parseUnsigned(
const std::string & s
);
Parses an unsigned integer value in decimal notation from the given string. Throws a SyntaxException if the string does not hold a number in decimal notation.
static UInt64 parseUnsigned64(
const std::string & s
);
Parses an unsigned 64-bit integer value in decimal notation from the given string. Throws a SyntaxException if the string does not hold a number in decimal notation.
static bool tryParse(
const std::string & s,
int & value
);
Parses an integer value in decimal notation from the given string. Returns true if a valid integer has been found, false otherwise. If parsing was not successful, value is undefined.
static bool tryParse64(
const std::string & s,
Int64 & value
);
Parses a 64-bit integer value in decimal notation from the given string. Returns true if a valid integer has been found, false otherwise. If parsing was not successful, value is undefined.
static bool tryParseFloat(
const std::string & s,
double & value
);
Parses a double value in decimal floating point notation from the given string. Returns true if a valid floating point number has been found, false otherwise. If parsing was not successful, value is undefined.
static bool tryParseHex(
const std::string & s,
unsigned & value
);
Parses an unsigned integer value in hexadecimal notation from the given string. Returns true if a valid integer has been found, false otherwise. If parsing was not successful, value is undefined.
static bool tryParseHex64(
const std::string & s,
UInt64 & value
);
Parses an unsigned 64-bit integer value in hexadecimal notation from the given string. Returns true if a valid integer has been found, false otherwise. If parsing was not successful, value is undefined.
static bool tryParseUnsigned(
const std::string & s,
unsigned & value
);
Parses an unsigned integer value in decimal notation from the given string. Returns true if a valid integer has been found, false otherwise. If parsing was not successful, value is undefined.
static bool tryParseUnsigned64(
const std::string & s,
UInt64 & value
);
Parses an unsigned 64-bit integer value in decimal notation from the given string. Returns true if a valid integer has been found, false otherwise. If parsing was not successful, value is undefined.