- Timestamp:
- May 13, 2013 11:28:22 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/mangling.h
r46008 r46010 1343 1343 # define RTStrICmp RT_MANGLER(RTStrICmp) 1344 1344 # define RTStrIStr RT_MANGLER(RTStrIStr) 1345 # define RTStrIsCaseFoldable RT_MANALER(RTStrIsCaseFoldable) 1346 # define RTStrIsLowerCased RT_MANALER(RTStrIsLowerCased) 1347 # define RTStrIsUpperCased RT_MANALER(RTStrIsUpperCased) 1345 1348 # define RTStrIsValidEncoding RT_MANGLER(RTStrIsValidEncoding) 1346 1349 # define RTStrmClearError RT_MANGLER(RTStrmClearError) -
trunk/include/iprt/string.h
r45392 r46010 2413 2413 2414 2414 /** 2415 * Checks if the string is case foldable, i.e. whether it would change if 2416 * subject to RTStrToLower or RTStrToUpper. 2417 * 2418 * @returns true / false 2419 * @param psz The string in question. 2420 */ 2421 RTDECL(bool) RTStrIsCaseFoldable(const char *psz); 2422 2423 /** 2424 * Checks if the string is upper cased (no lower case chars in it). 2425 * 2426 * @returns true / false 2427 * @param psz The string in question. 2428 */ 2429 RTDECL(bool) RTStrIsUpperCased(const char *psz); 2430 2431 /** 2432 * Checks if the string is lower cased (no upper case chars in it). 2433 * 2434 * @returns true / false 2435 * @param psz The string in question. 2436 */ 2437 RTDECL(bool) RTStrIsLowerCased(const char *psz); 2438 2439 /** 2415 2440 * Find the length of a zero-terminated byte string, given 2416 2441 * a max string length. -
trunk/src/VBox/Runtime/common/string/utf-8-case.cpp
r33562 r46010 339 339 RT_EXPORT_SYMBOL(RTStrToUpper); 340 340 341 342 RTDECL(bool) RTStrIsCaseFoldable(const char *psz) 343 { 344 /* 345 * Loop the code points in the string, checking them one by one until we 346 * find something that can be folded. 347 */ 348 RTUNICP uc; 349 do 350 { 351 int rc = RTStrGetCpEx(&psz, &uc); 352 if (RT_SUCCESS(rc)) 353 { 354 if (RTUniCpIsFoldable(uc)) 355 return true; 356 } 357 else 358 { 359 /* bad encoding, just skip it quietly (uc == RTUNICP_INVALID (!= 0)). */ 360 AssertRC(rc); 361 } 362 } while (uc != 0); 363 364 return false; 365 } 366 RT_EXPORT_SYMBOL(RTStrIsCaseFoldable); 367 368 369 RTDECL(bool) RTStrIsUpperCased(const char *psz) 370 { 371 /* 372 * Check that there are no lower case chars in the string. 373 */ 374 RTUNICP uc; 375 do 376 { 377 int rc = RTStrGetCpEx(&psz, &uc); 378 if (RT_SUCCESS(rc)) 379 { 380 if (RTUniCpIsLower(uc)) 381 return false; 382 } 383 else 384 { 385 /* bad encoding, just skip it quietly (uc == RTUNICP_INVALID (!= 0)). */ 386 AssertRC(rc); 387 } 388 } while (uc != 0); 389 390 return true; 391 } 392 RT_EXPORT_SYMBOL(RTStrIsUpperCased); 393 394 395 RTDECL(bool) RTStrIsLowerCased(const char *psz) 396 { 397 /* 398 * Check that there are no lower case chars in the string. 399 */ 400 RTUNICP uc; 401 do 402 { 403 int rc = RTStrGetCpEx(&psz, &uc); 404 if (RT_SUCCESS(rc)) 405 { 406 if (RTUniCpIsUpper(uc)) 407 return false; 408 } 409 else 410 { 411 /* bad encoding, just skip it quietly (uc == RTUNICP_INVALID (!= 0)). */ 412 AssertRC(rc); 413 } 414 } while (uc != 0); 415 416 return true; 417 } 418 RT_EXPORT_SYMBOL(RTStrIsLowerCased); 419 420
Note:
See TracChangeset
for help on using the changeset viewer.