Humanizer.IWordsToDecimalNumberConverter
IWordsToDecimalNumberConverter Interface
Converts localized decimal number words into System.Decimal values.
public interface IWordsToDecimalNumberConverter
Methods
IWordsToDecimalNumberConverter.Convert(string) Method
Converts words into a decimal value.
decimal Convert(string words);
Parameters
words System.String
The localized decimal number phrase to convert.
Returns
System.Decimal
The parsed decimal value.
Exceptions
System.ArgumentNullException
If words is null.
System.FormatException
If words is malformed or outside the supported System.Decimal range.
System.NotSupportedException
If decimal word parsing is not supported for the converter's locale.
IWordsToDecimalNumberConverter.TryConvert(string, decimal) Method
Attempts to convert words into a decimal value.
bool TryConvert(string words, out decimal parsedValue);
Parameters
words System.String
The localized decimal number phrase to convert.
parsedValue System.Decimal
When this method returns, contains the parsed value if successful; otherwise, zero.
Returns
System.Boolean
true if the phrase was parsed successfully; otherwise, false.
IWordsToDecimalNumberConverter.TryConvert(string, decimal, string) Method
Attempts to convert words into a decimal value and reports the first unrecognized token when parsing fails.
bool TryConvert(string words, out decimal parsedValue, out string? unrecognizedNumber);
Parameters
words System.String
The localized decimal number phrase to convert.
parsedValue System.Decimal
When this method returns, contains the parsed value if successful; otherwise, zero.
unrecognizedNumber System.String
When parsing fails, the best-effort unrecognized token or phrase.
Returns
System.Boolean
true if the phrase was parsed successfully; otherwise, false.