advertisement

Find Code  Advanced Search   

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
Implement VB6 string functions in VB5 (Improved Over MSKB Version)

Author: Jay Duhon
Category: String Manipulation
Type: Modules
Difficulty: Intermediate

Version Compatibility:  Visual Basic 5   Visual Basic 6  

More information: Visual Basic 6 has five intrinsic string functions not available to programmers using Visual Basic 5: InStrRev, Join, Split, Replace, and Reverse.

The Microsoft Knowledge Base at http://support.microsoft.com/support/kb/articles/q188/0/07.asp was previously suggested on this site as a resource for implementing these functions in VB5. But if you look at Microsoft's implementation, you'll see why Microsoft C++ programmers shouldn't try to write Visual Basic code. ;)

I fixed their poorly written Join and Split functions. Join was doing something redundant with an error handler, and Split was unnecessarily split(!) into two functions.

I wrote a Replace function of my own that is a bit more robust than Microsoft's version, and won't put you in an endless loop if you do something like Replace(MyString, "", "T") or Replace(MyString, "T", "T").

Note: I didn't change the InStrRev or Reverse functions, but included them for the sake of completeness.

This code has been viewed 131514 times.

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


Declarations:

Code:

No Text Boxes

Sponsored Links


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers