Quick and dirty. Funktionen tager ikke højde for om den evt. indsætter midt i et ord!
Function AddNbsp(pInput) Dim iBreak, strResult
iBreak = 20 If Len(pInput) >= iBreak Then strResult = Left(pinput, 20) & " " & Mid(pInput,20) Else strResult = pInput End If AddNbsp = strResult End Function
Prøv med nedenstående. Vil ikke afvise at det kan gøres smartere ;)
Function AddNbsp(pInput) Dim iBreak, strResult, iPos
iBreak = 20 If Len(pInput) >= iBreak Then If Mid(pInput, 20, 1) <> " " Then iPos = CInt(0 & InStr(20, pInput, " ")) If iPos > 0 Then StrResult = Left(pInput, iPos) & " " & Mid(pInput,iPos) Else strResult = Left(pinput, 20) & " " & Mid(pInput,20) End If Else strResult = Left(pinput, 20) & " " & Mid(pInput,20) End If Else strResult = pInput End If AddNbsp = strResult End Function
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.