This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
number_parsing [2017/03/21 16:05] – created korshun | number_parsing [2017/03/21 16:09] – korshun | ||
---|---|---|---|
Line 2: | Line 2: | ||
ACSUtils provides functions to convert strings to numbers. | ACSUtils provides functions to convert strings to numbers. | ||
- | Simple functions | + | ===== Simple functions |
+ | |||
+ | These simply return 0 on error: | ||
* [[functions: | * [[functions: | ||
* [[functions: | * [[functions: | ||
- | Complex functions: | + | < |
+ | atoi(" | ||
+ | atof(" | ||
+ | atoi(" | ||
+ | </ | ||
+ | |||
+ | ===== Complex functions | ||
+ | These return error status and result, and allow specifying an arbitrary base: | ||
* [[functions: | * [[functions: | ||
* [[functions: | * [[functions: | ||
+ | Error statuses are: | ||
+ | * PARSENUMBER_SUCCESS -- number successfully parsed, you can use the result | ||
+ | * PARSENUMBER_OVERFLOW -- the number is too big to fit into a variable, the result will be either [[constants: | ||
+ | * PARSENUMBER_BADFORMAT - the number could not be parsed at all. You **may not** use the result. '' |