Changeset 18544 in vbox for trunk/src/VBox/Runtime/common
- Timestamp:
- Mar 30, 2009 1:18:50 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/string/utf-8.cpp
r18528 r18544 1370 1370 } 1371 1371 1372 1372 1373 RTDECL(char *) RTStrToLower(char *psz) 1373 1374 { 1374 char *pszTmp = psz; 1375 while(*pszTmp) 1376 { 1377 /* Get the codepoints */ 1378 RTUNICP cp = RTStrGetCp(pszTmp); 1379 /* To lower */ 1375 /* 1376 * Loop the code points in the string, converting them one by one. 1377 * ASSUMES that the code points for upper and lower case are encoded 1378 * with the exact same length. 1379 */ 1380 /** @todo Handled bad encodings correctly+quietly, remove assumption, 1381 * optimize. */ 1382 char *pszCur = psz; 1383 while (*pszCur) 1384 { 1385 RTUNICP cp = RTStrGetCp(pszCur); 1380 1386 cp = RTUniCpToLower(cp); 1381 /* Put the converted codepoint back */ 1382 pszTmp = RTStrPutCp(pszTmp, cp); 1387 pszCur = RTStrPutCp(pszCur, cp); 1383 1388 } 1384 1389 return psz; 1385 1390 } 1386 1391 1392 1387 1393 RTDECL(char *) RTStrToUpper(char *psz) 1388 1394 { 1389 char *pszTmp = psz; 1390 while(*pszTmp) 1391 { 1392 /* Get the codepoints */ 1393 RTUNICP cp = RTStrGetCp(pszTmp); 1394 /* To lower */ 1395 /* 1396 * Loop the code points in the string, converting them one by one. 1397 * ASSUMES that the code points for upper and lower case are encoded 1398 * with the exact same length. 1399 */ 1400 /** @todo Handled bad encodings correctly+quietly, remove assumption, 1401 * optimize. */ 1402 char *pszCur = psz; 1403 while(*pszCur) 1404 { 1405 RTUNICP cp = RTStrGetCp(pszCur); 1395 1406 cp = RTUniCpToUpper(cp); 1396 /* Put the converted codepoint back */ 1397 pszTmp = RTStrPutCp(pszTmp, cp); 1407 pszCur = RTStrPutCp(pszCur, cp); 1398 1408 } 1399 1409 return psz;
Note:
See TracChangeset
for help on using the changeset viewer.