TryParseDecimal(Value: String; Var Result: Decimal): Boolean;
TryParseDecimal(Value: string; Var Result: decimal): boolean;
Value. Value converted into decimal type.
Result. Variable containing result in case of successful conversion.
The TryParseDecimal method checks if the specified value can be converted into decimal type according to regional standard settings.
If conversion is possible, the Result variable will contain the conversion result and the method returns True, otherwise False.
To execute the Fore.NET example, add a link to the ForeSystem system assembly.
Sub UserProc;
Var
CI: ICultureInfo;
B: Boolean;
D: Decimal;
Begin
CI := CultureInfo.Current;
B := CI.TryParseDecimal("1234,56789", D);
End Sub UserProc;
Imports Prognoz.Platform.Interop.ForeSystem;
…
Public Shared Sub Main(Params: StartParams);
Var
CultCls: ICultureInfoClass = New CultureInfoClassClass();
CI: ICultureInfo;
B: boolean;
D: decimal;
Begin
CI := CultCls.Current;
B := CI.TryParseDecimal("1234,56789", D);
End Sub;
After executing the example the D variable will contain the 1234.5679 value, and the B variable will contain the attribute of a successful conversion.
See also: