From: Wojtek on
Roedy Green wrote :
> On Wed, 14 Jul 2010 08:56:38 -0700, Roedy Green
> <see_website(a)mindprod.com.invalid> wrote, quoted or indirectly quoted
> someone who said :
>
>> private static final String SOMESPACES = " ";
>
> for some reason his is displaying improperly. That should be about 40
> spaces long.

Are you using an HTML editor? HTML eats any spaces after the first one.
Or you can use a non-breaking space &nbsp; to force extra displayable
spaces

--
Wojtek :-)


From: Arne Vajhøj on
On 15-07-2010 02:12, Stefan Ram wrote:
> Arne Vajh�j<arne(a)vajhoej.dk> writes:
>> But this is very basic functionality.
>
> Perl even has an own operator for it ('a' x 3 - or so),

I don't know about Perl, but Python allows:

'a' * 3

But my post about language features was only counting
pad methods of the string class.

> but BASIC does not have anything like it

VB.NET has it but probably not the older flavors.

Arne

From: Arne Vajhøj on
On 15-07-2010 03:35, Stefan Ram wrote:
> Andreas Leitgeb<avl(a)gamma.logic.tuwien.ac.at> writes:
>> I also wrote that my needs fortunately weren't all that general, so I got
>> by with a couple of stock pad-strings, of which I pick the needed one,
>> append it to the given string, and then do a .substring() on it. (it's
>> the chars '0' and '9' and a max len well below 20 *for my current needs*.
>
> I can not come up with a better solution now, but would suggest
> to hide this implementation behind an interface, so that you can
> easily replace this implementation in all you projects, once this
> is better supported in Java. Like,
>
> interface/class MyStringUtils
> { /** Appends multiple copies of padCharacter to the source, so that
> the result has lenght as its length when measured in Unicode code points. */
> public java.lang.String pad
> ( java.lang.String source, java.lang.String padCharacter, int length );
> ... }
>
> Then, go for the implementation that is most readable/maintainable first,
> and only optimize it for run-time speed, /if/ this was shown to be
> necessary.

Putting it in a reusable class makes a lot of sense.

I don't think an interface makes sense for something as low level
as this.

Arne