sitg
asked on
I want to Help vb convert to c# code
Public Function URLEncode(PlainText As String) As String
Dim pLen
pLen = Len(PlainText)
Dim HexPart As String
Dim z As Long
Dim OK As Boolean
Dim i As Long
Dim rtags() As String
Dim recognised As String
recognised = "*,+,-,.,0,1,2,3,4,5,6,7,8 ,9,_," & "A,B,C,D,E,F,G,H,I,J,K,L,M ,N,O,P,Q,R ,S,T,U,V,W ,X,Y,Z," & "a,b,c,d,e,f,g,h,i,j,k,l,m ,n,o,p,q,r ,s,t,u,v,w ,x,y,z"
rtags = Split(recognised, ",")
Dim Ptags() As String
ReDim Ptags(pLen)
For i = 1 To Len(PlainText)
Ptags(i) = Mid(PlainText, i, 1)
OK = False
For z = 0 To UBound(rtags)
If Ptags(i) = rtags(z) Then
OK = True: Exit For
End If
Next
If Not OK Then
HexPart = Hex(Asc(Ptags(i)))
If Len(HexPart) = 1 Then HexPart = "0" + HexPart
Ptags(i) = "%" + HexPart
End If
Next
URLEncode = Join(Ptags, "")
End Function
Dim pLen
pLen = Len(PlainText)
Dim HexPart As String
Dim z As Long
Dim OK As Boolean
Dim i As Long
Dim rtags() As String
Dim recognised As String
recognised = "*,+,-,.,0,1,2,3,4,5,6,7,8
rtags = Split(recognised, ",")
Dim Ptags() As String
ReDim Ptags(pLen)
For i = 1 To Len(PlainText)
Ptags(i) = Mid(PlainText, i, 1)
OK = False
For z = 0 To UBound(rtags)
If Ptags(i) = rtags(z) Then
OK = True: Exit For
End If
Next
If Not OK Then
HexPart = Hex(Asc(Ptags(i)))
If Len(HexPart) = 1 Then HexPart = "0" + HexPart
Ptags(i) = "%" + HexPart
End If
Next
URLEncode = Join(Ptags, "")
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER