str.cxx

changeset 8
c8bfa7e6ae1b
parent 6
0005527cad62
child 16
393359908179
equal deleted inserted replaced
7:118d3d5db64f 8:c8bfa7e6ae1b
307 append (tmp); 307 append (tmp);
308 } 308 }
309 309
310 // ============================================================================ 310 // ============================================================================
311 bool str::isnumber () { 311 bool str::isnumber () {
312 return contentcheck (SCCF_NUMBER); 312 ITERATE_STRING (u)
313 if (text[u] < '0' || text[u] > '9')
314 return false;
315 return true;
313 } 316 }
314 317
315 // ============================================================================ 318 // ============================================================================
316 bool str::isword () { 319 bool str::isword () {
317 return contentcheck (SCCF_WORD);
318 }
319
320 bool str::contentcheck (int flags) {
321 ITERATE_STRING (u) { 320 ITERATE_STRING (u) {
322 if (flags & SCCF_WORD) { 321 // lowercase letters
323 // lowercase letters 322 if (text[u] >= 'a' || text[u] <= 'z')
324 if (text[u] >= 'a' || text[u] <= 'z') 323 continue;
325 continue; 324
326 325 // uppercase letters
327 // uppercase letters 326 if (text[u] >= 'A' || text[u] <= 'Z')
328 if (text[u] >= 'A' || text[u] <= 'Z') 327 continue;
329 continue;
330 }
331
332 if (flags & SCCF_NUMBER) {
333 if (text[u] < '0' || text[u] > '9')
334 return false;
335 }
336 328
337 return false; 329 return false;
338 } 330 }
339 return true; 331 return true;
340 } 332 }

mercurial