| 1494 | } |
| 1495 | |
| 1496 | UString::size_type UString::find_last_not_of( |
| 1497 | const UString& str, |
| 1498 | size_type index /*= npos*/, |
| 1499 | size_type num /*= npos */) const |
| 1500 | { |
| 1501 | size_type i = 0; |
| 1502 | const size_type len = length(); |
| 1503 | if (index > len) |
| 1504 | index = len - 1; |
| 1505 | |
| 1506 | while (i < num && (index - i) != npos) |
| 1507 | { |
| 1508 | size_type j = index - i; |
| 1509 | // careful to step full Unicode characters |
| 1510 | if (j != 0 && _utf16_surrogate_follow(at(j)) && _utf16_surrogate_lead(at(j - 1))) |
| 1511 | { |
| 1512 | j = index - ++i; |
| 1513 | } |
| 1514 | // and back to the usual dull test |
| 1515 | unicode_char ch = getChar(j); |
| 1516 | if (!str.inString(ch)) |
| 1517 | return j; |
| 1518 | i++; |
| 1519 | } |
| 1520 | return npos; |
| 1521 | } |
| 1522 | |
| 1523 | UString::size_type UString::find_last_not_of(code_point ch, size_type index /*= npos */) const |
| 1524 | { |