This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| functions:parseint [2017/04/17 12:31] – korshun | functions:parseint [2017/04/17 12:38] (current) – korshun | ||
|---|---|---|---|
| Line 13: | Line 13: | ||
| * PARSENUMBER_BADFORMAT -- the number failed to parse. r2 is unchanged. | * PARSENUMBER_BADFORMAT -- the number failed to parse. r2 is unchanged. | ||
| + | <note tip>For simple parsing use [[atoi]].</ | ||
| + | |||
| + | ===== Examples ===== | ||
| + | < | ||
| + | ParseInt(" | ||
| + | r1 -> PARSENUMBER_SUCCESS | ||
| + | r2 -> 123 | ||
| + | |||
| + | ParseInt(" | ||
| + | r1 = PARSENUMBER_SUCCESS | ||
| + | r2 -> 0 | ||
| + | |||
| + | ParseInt(" | ||
| + | r1 -> PARSENUMBER_OVERFLOW | ||
| + | r2 -> 2147483647 | ||
| + | |||
| + | ParseInt(" | ||
| + | r1 -> PARSENUMBER_OVERFLOW | ||
| + | r2 -> -2147483647 | ||
| + | |||
| + | ParseInt(" | ||
| + | r1 -> PARSENUMBER_BADFORMAT | ||
| + | |||
| + | ParseInt(" | ||
| + | r1 -> PARSENUMBER_BADFORMAT | ||
| + | |||
| + | ParseInt(" | ||
| + | r1 -> PARSENUMBER_SUCCESS | ||
| + | r2 -> 255 | ||
| + | |||
| + | ParseInt(" | ||
| + | r1 -> PARSENUMBER_SUCCESS | ||
| + | r2 -> 255 | ||
| + | |||
| + | ParseInt(" | ||
| + | r1 -> PARSENUMBER_BADFORMAT | ||
| + | |||
| + | ParseInt | ||
| + | </ | ||