Dele en streng Virker ikke.
Jeg har følgende kode, som skulle dele en streng efter 20 tegn og tælle forfra hvis der var <br> i teksten, men den virker ikke.<% '**********
inputStr = (Forside.Fields.Item("Txt").Value)
reDim arr(0)
str = replace(Forside.Fields.Item("Txt").Value,"<br>",vbCrLf)
while (LEN(str)>0)
splitIndex = InStrRev(str, vbCrLf, 20)
if splitIndex = 0 then
splitIndex = InStrRev(str, " ", 20)
if splitIndex = 0 then splitIndex = LEN(str)
end if
ReDim Preserve arr(UBOUND(arr) + 1)
arr(UBOUND(arr)) = LEFT(str, splitIndex)
str = MID(str, splitIndex + 1)
wend
outStr = " "
for i = LBound(arr) to UBound(arr)
outStr = outStr & arr(i) & vbCrLf
next
outStr = replace (outStr, vbCrLf, "<br>")
Response.Write outStr
'**********
%>
Hvad gik der galt.
