Skrev ihop följande av gamla funktioner.
<%
' ---------------------------------------------------
' ### SKAPAR LÄNKARNA OCH DELAR ORD
Private Function fixString(str,int)
Dim sStr, part, i, pos, myStr
str = Replace(str, vbCrLf, " " &vbCrLf)
sStr = Split(str, " ")
For i=0 To Ubound(sStr)
part = sStr(i)
Dim isURL
isURL = False
' # HTTP
If Len(part) > 12 Then
If Left(LCase(part),7) = "http://" AND InStr(Right(part,Len(part)),".") > 0 Then
part = "<a href=""" &part& """ target=""_blank"">" &max_l(part,int)& "</a>"
isURL = True
End If
End If
' # WWW
If Len(part) > 8 Then
If Left(LCase(part),4) = "www." AND InStr(Right(part,Len(part)-5),".") > 0 Then
part = "<a href=""http://" &part& """ target=""_blank"">" &max_l(part,int)& "</a>"
isURL = True
End If
End If
' # FTP
If Len(part) > 11 Then
If Left(LCase(part),6) = "ftp://" AND InStr(Right(part,Len(part)-8),".") > 0 Then
part = "<a href=""" &part& """ target=""_blank"">" &max_l(part,int)& "</a>"
isURL = True
End If
End If
' # IRC
If Len(part) > 11 Then
If Left(LCase(part),6) = "irc://" AND InStr(Right(part,Len(part)-8),".") > 0 Then
part = "<a href=""" &part& """ target=""_blank"">" &max_l(part,int)& "</a>"
isURL = True
End If
End If
' # E-MAIL
If Len(part) > 5 Then
If InStr(part,"@") > 1 AND InStr(Right(part,Len(part)-InStr(part,"@")),".") > 2 Then
part = "<a href=""mailto:" &part& """>" &max_l(part,int)& "</a>"
isURL = True
End If
End If
If isURL = False Then
If Len(part) > int Then
part = Left(part,int)& "<br />" &Mid(part,int)
End If
End If
myStr = myStr& " " &part
Next
fixString = myStr
End Function
' ---------------------------------------------------
' ### FIXAR LÄNKENS INNEHÅLL
Private Function max_l(str,l)
If Len(str) > l then
max_l = Left(Server.HTMLEncode(str), l)& "... "
Else
max_l = str
End If
End Function
' ---------------------------------------------------
Dim str
str = "" ' Din text
Response.Write(fixString(str,35))
%>
