Parse
Description
Helper class for performing simple parsing tasks for strings.
Calling object.ToString will return the remaining text, but will not modify the state of the Parse object.
Public / Methods
Follows
Does the given string match the input that follows?
The current parse position is not modified by this method.
Integer
Parses the given string as an integer number.
- ValidatingException
-
If there is no integer number at the current parse position.
- See also
Parses an integer number.
Valid input strings are defined by the following rules of ParseGrammar:
-
For FormatFlags.NumberBaseDecimal: See
integer-10
rule. -
For FormatFlags.NumberBaseHexadecimal: See
integer-16
rule.
- ValidatingException
-
If there is no integer number at the current parse position.
- See also
Number
Parses the given string as a floating-point number.
- ValidatingException
-
If value in is not a floating-point number, as defined by the rule
float
of ParseGrammar.
- See also
Parses a floating-point number.
Valid input strings are defined by the float
rule of ParseGrammar.
- ValidatingException
-
If there is no floating-point number at the current parse position.
- See also
NumberLenient
Parses the given string as a floating-point number.
The method applies the following logic in order parse number strings in a lenient manner:
-
All whitespace characters are stripped from value in.
-
All ',' characters are stripped iff they occur twice or more.
-
All '.' characters are stripped iff they occur twice or more.
-
If either '.' or ',' is present, use it as decimal separator and parse the number.
-
Otherwise both '.' and ',' are present; use each as decimal separator, parse the number twice and use the number that has the larger absolute value.
Public / Attributes
ParseGrammar
The grammar of this class.
!float := sign? (decimal exponent? | infinity) | notanumber ; !integer-10 := sign? digit+ ; !integer-16 := (digit | 'a'..'f' | 'A'..'F')+ ; decimal := digit+ ('.' digit*)? | '.' digit+ ; exponent := @'E' sign? digit+ ; infinity := @'Inf' ; notanumber := @'NaN' ; digit := '0'..'9' ; sign := '-' | '+' ;