decode LEN decimal digits, return decoded number, -1 if invalid
| 884 | |
| 885 | // decode LEN decimal digits, return decoded number, -1 if invalid |
| 886 | int decodeDecimal( const lChar16 * str, int len ) { |
| 887 | int n = 0; |
| 888 | for ( int i=0; i<len; i++ ) { |
| 889 | if ( !str[i] ) |
| 890 | return -1; |
| 891 | int d = str[i] - '0'; |
| 892 | if ( d<0 || d>9 ) |
| 893 | return -1; |
| 894 | n = n*10 + d; |
| 895 | } |
| 896 | return n; |
| 897 | } |
| 898 | |
| 899 | bool lString16::atoi( int &n ) const |
| 900 | { |