| 713 | } |
| 714 | |
| 715 | void FString::StripLeft () |
| 716 | { |
| 717 | size_t max = Len(), i, j; |
| 718 | if (max == 0) return; |
| 719 | for (i = 0; i < max; ++i) |
| 720 | { |
| 721 | if (!isspace((unsigned char)Chars[i])) |
| 722 | break; |
| 723 | } |
| 724 | if (i == 0) |
| 725 | { // Nothing to strip. |
| 726 | return; |
| 727 | } |
| 728 | if (Data()->RefCount <= 1) |
| 729 | { |
| 730 | for (j = 0; i <= max; ++j, ++i) |
| 731 | { |
| 732 | Chars[j] = Chars[i]; |
| 733 | } |
| 734 | ReallocBuffer (j-1); |
| 735 | } |
| 736 | else |
| 737 | { |
| 738 | FStringData *old = Data(); |
| 739 | AllocBuffer (max - i); |
| 740 | StrCopy (Chars, old->Chars() + i, max - i); |
| 741 | old->Release(); |
| 742 | } |
| 743 | } |
| 744 | |
| 745 | void FString::StripLeft (const FString &charset) |
| 746 | { |
no test coverage detected