| 216 | } |
| 217 | |
| 218 | inline int32_t strCmpV(const char* _lhs, int32_t _lhsMax, const char* _rhs, int32_t _rhsMax) |
| 219 | { |
| 220 | int32_t max = min(_lhsMax, _rhsMax); |
| 221 | int32_t ii = 0; |
| 222 | int32_t idx = 0; |
| 223 | bool zero = true; |
| 224 | |
| 225 | for ( |
| 226 | ; 0 < max && _lhs[ii] == _rhs[ii] |
| 227 | ; ++ii, --max |
| 228 | ) |
| 229 | { |
| 230 | const uint8_t ch = _lhs[ii]; |
| 231 | if ('\0' == ch |
| 232 | || '\0' == _rhs[ii]) |
| 233 | { |
| 234 | break; |
| 235 | } |
| 236 | |
| 237 | if (!isNumeric(ch) ) |
| 238 | { |
| 239 | idx = ii+1; |
| 240 | zero = true; |
| 241 | } |
| 242 | else if ('0' != ch) |
| 243 | { |
| 244 | zero = false; |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | if (0 == max) |
| 249 | { |
| 250 | return _lhsMax == _rhsMax ? 0 : _lhs[ii] - _rhs[ii]; |
| 251 | } |
| 252 | |
| 253 | if ('0' != _lhs[idx] |
| 254 | && '0' != _rhs[idx]) |
| 255 | { |
| 256 | int32_t jj = 0; |
| 257 | for (jj = ii |
| 258 | ; 0 < max && isNumeric(_lhs[jj]) |
| 259 | ; ++jj, --max |
| 260 | ) |
| 261 | { |
| 262 | if (!isNumeric(_rhs[jj]) ) |
| 263 | { |
| 264 | return 1; |
| 265 | } |
| 266 | } |
| 267 | |
| 268 | if (isNumeric(_rhs[jj])) |
| 269 | { |
| 270 | return -1; |
| 271 | } |
| 272 | } |
| 273 | else if (zero |
| 274 | && idx < ii |
| 275 | && (isNumeric(_lhs[ii]) || isNumeric(_rhs[ii]) ) ) |