IBM®
Skip to main content
    Country/region select      Terms of use
 
 
   
     Home      Products      Services & solutions      Support & downloads      My account     

developerWorks  >  Lotus  >  Forums & community  >  Best Practice Makes Perfect

Best Practice Makes Perfect

A collaboration with Domino developers about how to do it and how to get it right in Domino

One thing that comes as an unpleasant surprise to folks who've grown up thinking in ASCII, is the default collation sequence in LotusScript. Because, you see, "A" < "b" < "C". This is nice when you're sorting a list of strings and like the de Veres to be somewhere in the neighborhood of the Dexters, but it has side effects you might not be aware of. For example, you might expect these expressions:

Case "A" To "Z"

If keyID Like "[A-Z][A-Z]###-## Then

to match only uppercase letters. In fact, they match all the lowercase letters also (except "a", which is less than "A").

There are probably a lot of applications out there that use expressions of this sort with the expectation that they're insuring the letters are the right case. It seems so obvious that it should that way, that people might not even think to test it. This is an example, if it were needed, of why one should test the obvious...

If you really want to check for just uppercase or just lowercase, you'll have to do one of two things:

  • List each separate character (keyID Like "[ABCDEFGHIJKLMNOPQRSTUVWXYZ][ABC...")
  • Use Option Compare Binary, which switches the collating sequence to one that groups all the uppercase letters in one bunch, and all the lowercase in another bunch.

Andre Guirard | 18 April 2008 10:59:59 AM ET | Home, Plymouth, MN, USA | Comments (10)

Search this blog 

Disclaimer 

    About IBM Privacy Contact