SBM ModScript Reference → Programming SBM ModScript → Object Types → Locale → Locale Parse-type-() Method
Uses locale awareness to parse the text value in "value".
bool ParseInt( value, int& out ) bool ParseInt64( value, int64_t& out ) bool ParseDouble( value, double& out )
Parameter | Type | Description |
---|---|---|
value |
string |
The value to parse. |
out |
int& int64_t& double& |
(Output) The value that receives the parsed number. |
Type | Description |
---|---|
bool |
Returns true if the value was successfully parsed. |
SBM ModScript version: 11.3.
var germanLocale = CreateLocale("de_DE"); var intV = 0; var intR = germanLocale.ParseInt("2345", intV ); Ext.WriteStream( "int: result: ${intR}, expected: 2345, parsed: ${intV}" ); var int64V = 0ll; var int64R = germanLocale.ParseInt64("422564125658", int64V ); Ext.WriteStream( "int64_t: result: ${int64R}, expected: 422564125658, parsed: ${int64V}" ); var dblV = 0.0; var dblR = germanLocale.ParseDouble("234,2342", dblV ); Ext.WriteStream( "double: result: ${dblR}, expected: 234.2342, parsed: ${dblV}" );
Result:
int: result: true, expected: 2345, parsed: 2345 int64_t: result: true, expected: 422564125658, parsed: 422564125658 double: result: true, expected: 234.2342, parsed: 234.2342
Check the return value for success before using "out".
Copyright © 2007–2019 Micro Focus or one of its affiliates. All rights reserved.