That would cause an IndexOutOfBoundsException if the string was shorter
than 100 chars. Try this instead:
String.format("%.100s", s);
That would return up to 100 characters from the beginning of the string
's'.
> -----Original Message-----
> From: Avlesh Singh [mailto:[email protected]]
> Sent: Monday, June 22, 2009 11:42 AM
> To: Struts Users Mailing List
> Subject: Re: Display only 100 chars of a string
>
> <c:out value="${fn:substring(yourString, start, end)}"/>
>
> Cheers
> Avlesh
>
> On Mon, Jun 22, 2009 at 9:07 PM, Stefano Tranquillini <
> [email protected]> wrote:
>
> > Hi all.
> > there's a possibility inside a jsp to display only the
> first 100 chars
> > or the first 10 words of a string?
> > if i have a long string, can i display only the first 100 chars
> > directly in a jsp without modification in action or something like
> > that?
> > thanks
> > --
> > Stefano
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]