Localization: 5.1 Lexical Functions: Comparing Strings

Up: GEOS SDK TechDocs | Up | Prev: 5 Lexical Functions | Next: 5.2 String Length and Size
LocalCmpStrings(), LocalCmpStringsNoCase(), LocalCmpStringsNoSpace(), LocalCmpStringsNoSpaceCase(), LocalGetLanguage(), LocalCmpChars(), LocalCmpCharsNoCase()

LocalCmpStrings() takes two strings as arguments and says which, if either, comes first alphabetically. LocalCmpStringsNoCase() does the same thing but is not case sensitive. LocalCmpStrings() does a better job of ordering strings than assembly language instructions such as cmps that just compare ASCII values. Since the ASCII value of "a" places it after "Z", it is advisable to use LocalCmpStrings() , which uses the localized lexical values. When comparing two strings for equality, assembly instructions like cmps may be used safely.

The LocalCmpStringsNoSpace() and LocalCmpStringsNoSpaceCase() routines are like the LocalCmpStrings() and LocalCmpStringsNoCase() routines, except that spaces and punctuation marks are ignored. Note that if you are comparing only a certain number of characters that spaces and punctuation marks will not be included in this number.

The sort order of the strings will depend on the language used when sorting them. To find out the current language used for sorting, call LocalGetLanguage() .

There are two assembly routines LocalCmpChars() and LocalCmpCharsNoCase() which allow for the quick lexical comparison of two characters.


Up: GEOS SDK TechDocs | Up | Prev: 5 Lexical Functions | Next: 5.2 String Length and Size