webForumDet fria alternativet

funktion för långa rader

ASP

0 svar · 158 visningar · startad av Gimbo

Medlem sedan dec. 20001 626 inlägg
Frågan#1

har en funktion för långa rader som ser ut på följande sätt:

'FUNKTION FÖR LÅNGA RADER
	function doIt(textSomSkaFixas)
	arrText = split(textSomSkaFixas, " ") 
	for i = 0 To uBound(arrText)
	if Len(arrText(i)) > 35 then
	newText = newText & " " & Left(arrText(i), 35)
	'newText = newText & " " & Right(arrText(i), Len(arrText(i)-35))
	newText = newText & " " & Right(arrText(i), Len(arrText(i))-35)
	else
	newText = newText & " " & arrText(i)
	end if
	next
	doIt = newText
	end function

nu är det så att den splittra en lång rad, dvs efter 35 tecken så slittrar den raden skillt med ett mellanslag, men hur gör jag ifall jag vill att den ska radbryta efter 35tecken... har testat följande men det fungerar inte...

' FUNKTION FÖR LÅNGA RADER
	function doIt(textSomSkaFixas)
	arrText = replace(split(textSomSkaFixas), "vbcrlf ", "<br>") 
	for i = 0 To uBound(arrText)
	if Len(arrText(i)) > 35 then
	newText = newText & " " & Left(arrText(i), 35)
	'newText = newText & " " & Right(arrText(i), Len(arrText(i)-35))
	newText = newText & " " & Right(arrText(i), Len(arrText(i))-35)
	else
	newText = newText & " " & arrText(i)
	end if
	next
	doIt = newText
	end function
260 ms totalt · 4 externa anrop · v20260731065814-full.86ec41c2
121 ms — deklarationer (db)
0 ms — hämta statistik (cache)
135 ms — hämta tråd, inlägg och bilagor (db)
122 ms — ändringar (db)