# Poco

# class NumberParser

Library: Foundation
Package: Core
Header: Poco/NumberParser.h

## Description

The NumberParser class provides static methods for parsing numbers out of strings.

## Member Summary

Member Functions: parse, parse64, parseFloat, parseHex, parseHex64, parseUnsigned, parseUnsigned64, tryParse, tryParse64, tryParseFloat, tryParseHex, tryParseHex64, tryParseUnsigned, tryParseUnsigned64

## Member Functions

### parse

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.

### parse64

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.

### parseFloat

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.

### parseHex

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.

### parseHex64

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.

### parseUnsigned

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.

### parseUnsigned64

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.

### tryParse

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.

### tryParse64

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.

### tryParseFloat

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.

### tryParseHex

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.

### tryParseHex64

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.

### tryParseUnsigned

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.

### tryParseUnsigned64

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.