[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Algorithm for splitting a string at a space


Subject: Re: [xsl] Algorithm for splitting a string at a space
From: "Liam R. E. Quin liam@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 23 Nov 2015 22:12:04 -0000

On Mon, 2015-11-23 at 19:05 +0000, Rick Quatro rick@xxxxxxxxxxxxxx
wrote:
> Hello,
> 
> I have a series of strings that I need to split if they are longer
> than a
> particular length, say 30 characters. But I need to make the split at
> the
> previous space.

What I do is something like,
(1) use substring to truncate at 30 characters
(2) remove a trailing space and any number of not-space characters
B  B  with replace()
(3) if there's nothing left, use the first 27 characters followd by ...
or b&B 

That's probably the same as David's algorithm in effect.

Liam


-- 
Liam R. E. Quin <liam@xxxxxx>
The World Wide Web Consortium (W3C)


Current Thread