Re: parsing string, leaving words intact by Ray
Ray
Thu Oct 30 23:07:56 CST 2003
Here's a vb SCRIPT way.
<%
TheString = "I need to parse a long string into no more than 30 character
chunks, but I also need to leave the words intact. Right now, I am using
and it's fine, but splits up some of the words. If I could figure out how
to find the preceding space of the 30 limit, I'd be in good shape. Any
thoughts would be appreciated. Many thanks in advance."
'''clear out any double+ spaces
Do While Instr(TheString, " ") > 0
TheString = Replace(TheString, " ", " ")
Loop
aParts = Split(TheString, " ")
Redim Preserve aParts(29)
For q = 0 To 29
Response.Write aParts(q) & "<br>"
Next
%>
Ray at home
"meldrape" <anonymous@discussions.microsoft.com> wrote in message
news:04d801c39f3a$fd9c62f0$a301280a@phx.gbl...
> Hello,
>
> I need to parse a long string into no more than 30
> character chunks, but I also need to leave the words
> intact. Right now, I am using:
>
> For intStart = 1 to Len(strOriginal) by 30
> strPrint = Mid$(strOriginal, intStart, 30)
> Print #detailFile, Tab(1), intStart, Tab(4), strPrint
> Next intStart
>
> and it's fine, but splits up some of the words. If I
> could figure out how to find the preceding space of the
> 30 limit, I'd be in good shape. Any thoughts would be
> appreciated. Many thanks in advance.
>