| 599 | } |
| 600 | |
| 601 | BString BString::toLowerCase() const { |
| 602 | if (isEmpty()) { |
| 603 | return *this; |
| 604 | } |
| 605 | // can't just copy len and level, they might not be set yet for literals |
| 606 | BStringData* d = allocNewData(); |
| 607 | d->level = getLevel(); |
| 608 | d->str = getNewString(d->level); |
| 609 | d->len = length(); |
| 610 | d->incRefCount(); |
| 611 | |
| 612 | std::locale loc; |
| 613 | for (int i = 0; i < d->len; i++) { |
| 614 | d->str[i] = std::tolower(data->str[i], loc); |
| 615 | } |
| 616 | d->str[d->len] = 0; |
| 617 | return BString(d); |
| 618 | } |
| 619 | |
| 620 | BString BString::toUpperCase() const { |
| 621 | if (isEmpty()) { |
no test coverage detected