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:avl...@gmail.com] 
> 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 <
> stefano.tranquill...@gmail.com> 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: user-unsubscr...@struts.apache.org
> > For additional commands, e-mail: user-h...@struts.apache.org
> >
> >
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to