Another newbie question…
I am trying to make a file with substrings with a fixed lenght. Using a texteditor I sometimes have shorter substrings. I want to add additional characters to get the needed lenght of the string. I am trying the paddedleft and paddedright to add the characters, but it does not seem to work.

String paddedLeft (juce_wchar padCharacter, int minimumLength) const;

part of the code:

String naam = editor1->getText(); naam.paddedLeft(1,20);

I am adding the character “1” to the string so it has the total of 20 characters. What do I do wrong? Or is there a much better way of doing this?





String naam = editor1->getText();
naam = naam.paddedLeft(1,20);

or better:

String naam = editor1->getText().paddedLeft(1,20);



Aha! thanks. Typical newbie question. I do not understand why I missed that obvious one.

Is the second way of coding only more efficient in syntax, or also in compiler efficiency?

Kind regards,



Surely you mean paddedLeft ('1', 20) ???


Your totally correct! Thanks!