TryParse()

Decimal::TryParse(const String&, Decimal&) method

Converts the specified string containing the string representation of a number to the equivalent Decimal value.

static bool System::Decimal::TryParse(const String &value, Decimal &result)

Arguments

ParameterTypeDescription
valueconst String&The string to convert
resultDecimal&The reference to a Decimal variable where the result of the conversion is put

Return Value

True if the conversion succeeded, otherwise - false

Decimal::TryParse(const String&, Globalization::NumberStyles, const SharedPtr<IFormatProvider>&, Decimal&) method

Converts the specified string containing the string representation of a number to the equivalent Decimal value using the provided formatting information and number style.

static bool System::Decimal::TryParse(const String &value, Globalization::NumberStyles styles, const SharedPtr<IFormatProvider> &provider, Decimal &result)

Arguments

ParameterTypeDescription
valueconst String&The string to convert
stylesGlobalization::NumberStylesA bitwise combination of values of NumberStyles enum that specifies the permitted style of the string representation of a number
providerconst SharedPtr<IFormatProvider>&A pointer to an object that contains the string format information
resultDecimal&An output argument; contains the result of conversion

Return Value

True if the conversion succeeded, otherwise - false

See Also