Ver Mensaje Individual
  #5 (permalink)  
Antiguo 05/05/2005, 02:34
Avatar de trasgukabi
trasgukabi
 
Fecha de Ingreso: septiembre-2004
Mensajes: 2.749
Antigüedad: 20 años, 8 meses
Puntos: 18
purpose:

The URLDecode function decodes a URL encoded string back into the original text.

syntax:

string = URLDecode(encodedstring)

example usage:

<% = URLDecode( Server.URLEncode( "@ can't find ... that & this?" ) ) %>

source code:

Código:
<%
Private Function URLDecode(byVal encodedstring)
	Dim strIn, strOut, intPos, strLeft
	Dim strRight, intLoop
	strIn  = encodedstring : strOut = _
		 "" : intPos = Instr(strIn, "+")
	Do While intPos
		strLeft = "" : strRight = ""
		If intPos > 1 then _
			strLeft = Left(strIn, intPos - 1)
		If intPos < len(strIn) then _
			strRight = Mid(strIn, intPos + 1)
		strIn = strLeft & " " & strRight
		intPos = InStr(strIn, "+")
		intLoop = intLoop + 1
	Loop
	intPos = InStr(strIn, "%")
	Do while intPos
		If intPos > 1 then _
			strOut = strOut & _
				Left(strIn, intPos - 1)
		strOut = strOut & _
			Chr(CInt("&H" & _
				mid(strIn, intPos + 1, 2)))
		If intPos > (len(strIn) - 3) then
			strIn = ""
		Else
			strIn = Mid(strIn, intPos + 3)
		End If
		intPos = InStr(strIn, "%")
	Loop
	URLDecode = strOut & strIn
End Function
%>