Ciao a tutti ...
Io ho due funzioni molto utili, la prima spezza le parole che superano un tot numero di caratteri, l'altra forma i link in maniera automatica.
L'unico problema è che se un link supera la lunghezza consentita, me lo spezza e quindi il link risulta inaccessibile.
vorrei sapere se è possibile modificare la funzione per la divisione delle parole inserendo qualcosa che dica che quando c'è un http:// di non dividere finchè la parola non è finita ...
di seguito posto i due codici
Funzione per la divisione delle parole
codice:<% Function shareWords(tempTXT) Limit = 90 arrTXT = Split(tempTXT) For x = 0 To UBound(arrTXT) tempLenght = Len(arrTXT(x)) If tempLenght > Limit Then Count = tempLenght / Limit If Count - CInt(Count) <> 0 Then Count = Count + 1 End If start = 1 For y = 1 To Count Response.Write Mid(arrTXT(x),start,Limit) & " " start = start + Limit Next Else Response.Write arrTXT(x) & " " End If Next End Function
Funzione per la creazione automatica dei link
codice:Function IsEmail(tempEmail) If Len(tempEmail) < 8 Then IsEmail = False Else At = 0 For x = 1 To Len(tempEmail) If Mid(tempEmail,x,1) = "@" Then At = At + 1 End If Next If Len(Mid(tempEmail,(InStrRev(tempEmail,".") + 1),Len(tempEmail))) < 2 Then At = 0 End If If At <> 1 Then IsEmail = False Else IsEmail = True End If End If End Function Sub MakeLinks(tempString) arrTempString = Split(tempString) For Each Word In arrTempString If Left(Word,7) = "http://" Then tempOutput = tempOutput & "<a href=""" & Word & """ target=""_blank"">" &_ Word & "</a> " ElseIf Left(Word,4) = "www." Then tempOutput = tempOutput & "" & Word & " " ElseIf IsEmail(Word) Then tempOutput = tempOutput & "<a href=""mailto:" & Word & """>" & Word &_ "</a> " Else tempOutput = tempOutput & Word & " " End If Next tempString = tempOutput End Sub %>

Rispondi quotando
