Choose Compares Carefully

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 resultwill not be "internationally" correct. Using an ASCII comparesimply tests the string for which the ASCII values of one character comebefore those of another. The StrComp() function uses the current code pagesetting in Windows to determine which characters alphabetize before othersbased on the current country setting. Using the StrComp() when sortingand displaying output to your user will make your application much moreinternationally friendly. If you are sorting and testing for internal purposes, an ASCII compareis much faster. Make sure you are consistent with the compares or yourresults might not be what you expect. Don't do a binary chop against analphabetized 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 fifthbit of characters "A-Z," "a-z." To adjust case properlyfor international character sets, use StrConv(string$, vbUpperCase|vbLowerCase).Once again, for your own code's internal use, use UCase$()/LCase$() becausethey are faster, but for display purposes use StrConv(). During testing of UCase$() .versus StrConv(), both returned the sameresults under VB4. However, since StrConv() provides other services youmay need (or in case this was simply a Microsoft bug), you should stilluse StrConv() in place of UCase$()/LCase$().

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several