| 1195 | } |
| 1196 | |
| 1197 | String String::paddedRight (const juce_wchar padCharacter, int minimumLength) const |
| 1198 | { |
| 1199 | jassert (padCharacter != 0); |
| 1200 | |
| 1201 | auto extraChars = minimumLength; |
| 1202 | CharPointerType end (text); |
| 1203 | |
| 1204 | while (! end.isEmpty()) |
| 1205 | { |
| 1206 | --extraChars; |
| 1207 | ++end; |
| 1208 | } |
| 1209 | |
| 1210 | if (extraChars <= 0 || padCharacter == 0) |
| 1211 | return *this; |
| 1212 | |
| 1213 | auto currentByteSize = (size_t) (((char*) end.getAddress()) - (char*) text.getAddress()); |
| 1214 | String result (PreallocationBytes (currentByteSize + (size_t) extraChars * CharPointerType::getBytesRequiredFor (padCharacter))); |
| 1215 | auto n = result.text; |
| 1216 | |
| 1217 | n.writeAll (text); |
| 1218 | |
| 1219 | while (--extraChars >= 0) |
| 1220 | n.write (padCharacter); |
| 1221 | |
| 1222 | n.writeNull(); |
| 1223 | return result; |
| 1224 | } |
| 1225 | |
| 1226 | //============================================================================== |
| 1227 | String String::replaceSection (int index, int numCharsToReplace, StringRef stringToInsert) const |
no test coverage detected