webForumDet fria alternativet

text length

1 svar · 199 visningar · startad av Organick

OrganickMedlem sedan okt. 200120 inlägg
#1

I wounder if anyone here knows how I make a recordset that only shows the first 30 words of maybe 300 words.

LarsGMedlem sedan dec. 200012 464 inlägg
#2

I do not see how you can do it in your select-statement, but using a regexp in VB-script makes it possible.

set o = new regexp
o.global = true
o.pattern = "(([a-zA-z0-9])*([\ \,\.])*)"
t = rs("yourColumn")
Set Matches = o.Execute(t)
if matches.count > 29 then i = 29 else i = matches.count

response.write mid(t,1,matches.item(i).firstindex+matches.item(i).length)

Probably the pattern may be written in some other manner and you may wish to add some extra characters that delimits words. (I'm rather new to regexp.)

red: Some hatched variable names
------------------
essentitia preter non sans multiplicandum

[Redigerat av LarsG den 05 okt 2001]

129 ms totalt · 3 externa anrop · v20260731065814-full.30151723
0 ms — hämta forumlista (cache)
0 ms — hämta statistik (cache)
125 ms — hämta tråd, inlägg och bilagor (db)