You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Mark Lybarger <ml...@gmail.com> on 2005/11/18 16:21:28 UTC
commons-lang StringUtils.rightPad - truncate
docs for StringUtils.rightPad("FOO",1) shows that it returns "FOO".
Is there a method to get the rightPadding to also handle truncation?
I'm looking to format fixed length fields where the output has to be X
and only X characters. thus i have to truncate anythe extra stuff
that might be there.
thanks!
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: commons-lang StringUtils.rightPad - truncate
Posted by Elifarley Callado Coelho Cruz <el...@gmail.com>.
I have develop a StringKit class which has a rightPad method that
handles truncation as well. I can send it to you (it's LGPL).
Regards,
Elifarley
On 11/18/05, Mark Lybarger <ml...@gmail.com> wrote:
> docs for StringUtils.rightPad("FOO",1) shows that it returns "FOO".
> Is there a method to get the rightPadding to also handle truncation?
> I'm looking to format fixed length fields where the output has to be X
> and only X characters. thus i have to truncate anythe extra stuff
> that might be there.
>
> thanks!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: commons-lang StringUtils.rightPad - truncate
Posted by Stephen Colebourne <sc...@btopenworld.com>.
[lang] does not have such a method at present. It is quite a good
suggestion however. Perhaps you would consider raising an enhancement
request?
Stephen
Mark Lybarger wrote:
> docs for StringUtils.rightPad("FOO",1) shows that it returns "FOO".
> Is there a method to get the rightPadding to also handle truncation?
> I'm looking to format fixed length fields where the output has to be X
> and only X characters. thus i have to truncate anythe extra stuff
> that might be there.
>
> thanks!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org