ucx/string.c

changeset 175
9e14d920a7d0
parent 174
e7e56c56d126
child 255
bf19378aed58
equal deleted inserted replaced
172:cd9f1e772fd0 175:9e14d920a7d0
337 } else { 337 } else {
338 return memcmp(string.ptr+string.length-suffix.length, 338 return memcmp(string.ptr+string.length-suffix.length,
339 suffix.ptr, suffix.length) == 0; 339 suffix.ptr, suffix.length) == 0;
340 } 340 }
341 } 341 }
342
343 sstr_t sstrlower(sstr_t string) {
344 sstr_t ret = sstrdup(string);
345 for (size_t i = 0; i < ret.length ; i++) {
346 ret.ptr[i] = tolower(ret.ptr[i]);
347 }
348 return ret;
349 }
350
351 sstr_t sstrlower_a(UcxAllocator *allocator, sstr_t string) {
352 sstr_t ret = sstrdup_a(allocator, string);
353 for (size_t i = 0; i < ret.length ; i++) {
354 ret.ptr[i] = tolower(ret.ptr[i]);
355 }
356 return ret;
357 }
358
359 sstr_t sstrupper(sstr_t string) {
360 sstr_t ret = sstrdup(string);
361 for (size_t i = 0; i < ret.length ; i++) {
362 ret.ptr[i] = toupper(ret.ptr[i]);
363 }
364 return ret;
365 }
366
367 sstr_t sstrupper_a(UcxAllocator *allocator, sstr_t string) {
368 sstr_t ret = sstrdup_a(allocator, string);
369 for (size_t i = 0; i < ret.length ; i++) {
370 ret.ptr[i] = toupper(ret.ptr[i]);
371 }
372 return ret;
373 }

mercurial