MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / paddedRight

Method paddedRight

JUCE/modules/juce_core/text/juce_String.cpp:1197–1224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1195}
1196
1197String 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//==============================================================================
1227String String::replaceSection (int index, int numCharsToReplace, StringRef stringToInsert) const

Callers 10

getStringMethod · 0.80
dumpDebugTraceMethod · 0.80
toStringMethod · 0.80
printCommandDescriptionFunction · 0.80
addOSCMessageArgumentFunction · 0.80
getIndentationStringFunction · 0.80
getAudioPluginDefinesMethod · 0.80

Calls 6

PreallocationBytesClass · 0.85
isEmptyMethod · 0.45
getAddressMethod · 0.45
writeAllMethod · 0.45
writeMethod · 0.45
writeNullMethod · 0.45

Tested by

no test coverage detected