advertisement

Find Code  Advanced Search   

Free Newsletters:   
browse free vb code
Submit Code
ASP,  HTML, and XML
Database
Dates  and Math
Files  and Directories
Forms  and Controls
Lists,  Collections, and Arrays
Miscellaneous
Multimedia/Games
Office/VBA
Network/Internet
Registry
Screen/Graphics
String  Manipulation
System/API
Windows  2000/XP
VB.NET/ASP.NET



advertisement
URLEncode for Large Strings

Author: Alexander Buschek
Category: String Manipulation
Type: Snippets
Difficulty: Intermediate

Version Compatibility:  Visual Basic 6  

More information: ASP programmers know URLEncode very well. When I was looking for a snippet on the internet I found the regular apporach: run through every character in the string (for ... to len(txt)) and add either the original character or the replaced Code (%XX). This works fine for small strings. But when you want to URLEncode a large string (let's say 10,000 characters) this can take minutes due to the way MS implements string operations. So I took a different approach: I just replace all characters from chr(0) to chr(255) by their URL encoded expression. So this obviously makes sense if you have strings that are longer than let's say 255 characters. Any suggestions? And thanks to all contributers that helped me so much in the past!

This code has been viewed 57326 times.

Instructions: Copy the declarations and code below and paste directly into your VB project.


Declarations:

Code:

No Text Boxes

Sponsored Links