ICultureInfo.TryParseCurrency

Syntax

TryParseCurrency(Value: String; Var Result: Currency): Boolean;

TryParseCurrency(Value: string; Var Result: decimal): boolean;

Parameters

Value. Value converted into currency type.

Result. Variable containing result in case of successful conversion.

Value. Value converted into decimal type.

Result. Variable containing result in case of successful conversion.

Description

The TryParseCurrency method checks if the specified value can be converted into the currency type according to regional standard settings.

NOTE. In Fore.NET, the TryParseCurrency method checks if the specified value can be converted into decimal type according to regional standard settings.

Comments

If conversion is possible, the Result variable will contain the conversion result and the method returns True, otherwise False.

Example

To execute the Fore.NET example, add a link to the ForeSystem system assembly.

Sub UserProc;
Var
    CI: ICultureInfo;
    B: Boolean;
    Cur: Currency;
Begin
    CI := CultureInfo.Current;
    B := CI.TryParseCurrency("1234,56789", Cur);
End Sub UserProc;

Imports Prognoz.Platform.Interop.ForeSystem;

Public Shared Sub Main(Params: StartParams);
Var
    CultCls: ICultureInfoClass = New CultureInfoClassClass();
    CI: ICultureInfo;
    B: boolean;
    Cur: decimal;
Begin
    CI := CultCls.Current;
    B := CI.TryParseCurrency(
"1234,56789"Cur);
End Sub;

After executing the example the Cur variable will contain the 1234.5679 value, and the B variable will contain the attribute of a successful conversion.

See also:

ICultureInfo