| 1448 | } |
| 1449 | |
| 1450 | UString::size_type UString::find_last_of(const UString& str, size_type index /*= npos*/, size_type num /*= npos */) |
| 1451 | const |
| 1452 | { |
| 1453 | size_type i = 0; |
| 1454 | const size_type len = length(); |
| 1455 | if (index > len) |
| 1456 | index = len - 1; |
| 1457 | |
| 1458 | while (i < num && (index - i) != npos) |
| 1459 | { |
| 1460 | size_type j = index - i; |
| 1461 | // careful to step full Unicode characters |
| 1462 | if (j != 0 && _utf16_surrogate_follow(at(j)) && _utf16_surrogate_lead(at(j - 1))) |
| 1463 | { |
| 1464 | j = index - ++i; |
| 1465 | } |
| 1466 | // and back to the usual dull test |
| 1467 | unicode_char ch = getChar(j); |
| 1468 | if (str.inString(ch)) |
| 1469 | return j; |
| 1470 | i++; |
| 1471 | } |
| 1472 | return npos; |
| 1473 | } |
| 1474 | |
| 1475 | UString::size_type UString::find_last_of(code_point ch, size_type index /*= npos */) const |
| 1476 | { |
no test coverage detected