add whitespace at end of string until string reaches maxlength
843829Feb 7 2006 — edited Feb 7 2006I am having difficulty making a loop which takes a string which you enter in, and then appends a space at the end of the string and keeps adding a space until the string is maxlength
the name of the string is target and maxSize is set to 10 so the code would be somewhere along the lines of
<code>
while (target.length() < maxSize)
{
target.append(" ") //adds a space at the end of the string
}
return (target);} //string with spaces added to the end to fill 10 spaces
</code>
I know this code doesn't work but I just need some sort of tip to put me in the right direction... any help is appreciated