Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Expertise: Beginner
Aug 6, 1997



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Choose Compares Carefully

A straight ASCII compare, such as 'F "A" < "B" THEN' is much faster then using VB's StrComp("A", "B", 1). However, when you use this test to sort an array of strings, your result will not be "internationally" correct. Using an ASCII compare simply tests the string for which the ASCII values of one character come before those of another. The StrComp() function uses the current code page setting in Windows to determine which characters alphabetize before others based on the current country setting. Using the StrComp() when sorting and displaying output to your user will make your application much more internationally friendly. If you are sorting and testing for internal purposes, an ASCII compare is much faster. Make sure you are consistent with the compares or your results might not be what you expect. Don't do a binary chop against an alphabetized array using an ASCII compare or vice versa. On the same note, using UCase$() (or LCase$()) is very fast. However, these functions only zip through a string, setting or clearing the fifth bit of characters "A-Z," "a-z." To adjust case properly for international character sets, use StrConv(string$, vbUpperCase|vbLowerCase). Once again, for your own code's internal use, use UCase$()/LCase$() because they are faster, but for display purposes use StrConv(). During testing of UCase$() .versus StrConv(), both returned the same results under VB4. However, since StrConv() provides other services you may need (or in case this was simply a Microsoft bug), you should still use StrConv() in place of UCase$()/LCase$().
MicroHelp Uninstaller
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date