parseNumber: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " <dl class="command_description"> <dt><dt>" to " <dl class="command_description"> <dt><dt>")
m (Text replacement - "\| arma1 \|1.00 \|([^g]|g[^a])" to "| arma1 |1.00 |game2= arma2 |version2= 1.00 |game3= arma2oa |version3= 1.50 |game4= tkoh |version4= 1.00 |game5= arma3 |version5= 0.50 |$1")
Line 2: Line 2:


| arma1
| arma1
|1.00


|1.00
|game2= arma2
|version2= 1.00
 
|game3= arma2oa
|version3= 1.50
 
|game4= tkoh
|version4= 1.00
 
|game5= arma3
|version5= 0.50


|gr1= Strings
|gr1= Strings

Revision as of 23:09, 12 June 2021

Hover & click on the images for description

Description

Description:
Description needed
Groups:
Strings

Syntax

Syntax:
Syntax needed
Parameters:
string: String
Return Value:
Number

Alternative Syntax

Syntax:
parseNumber boolean Template:Since
Parameters:
boolean: Boolean
Return Value:
Number - 0 if false, 1 if true

Examples

Example 1:
_number = parseNumber "0.125"; // 0.125
Example 2:
_number = parseNumber "0050"; // 50
Example 3:
_number = parseNumber "2 abc"; // 2
Example 4:
_number = parseNumber true; // 1

Additional Information

See also:
BIS_fnc_parseNumber

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Posted on Aug 28, 2014
ffur2007slx2_5
(A3 1.26)It only detects the first occurrence of a number in the string, return 0 by default. parseNumber "2s4f"; // 2 parseNumber "s2f4"; // 0 parse config or code, currently BIS_fnc_parseNumber, occurrence is only limited with number, return -1 by default. {s3s4f} call BIS_fnc_parseNumber; // -1
Posted on April 5, 2021 - 14:56 (UTC)
R3vo
This command does not work with strings representing hexadecimal numbers: parseNumber "0xCF"; //Returns 0