SCANSTRING and lower case searches

This is a case where the documentation is clear but the default value is at best strange.

The built in SCANSTRING function’s 4th parameter, “Compare in uppercase”, which defaults to “1”, meaning no, does exactly the opposite. While the naming of the parameter and the default value is at best strange, the note in the documentation is clear: Using the default value you cannot find anything if searching with a lowercase string.

Not. A. Thing.

Apparently the default value of “don’t compare in uppercase” (if the name is to be taken seriously) means that the string we are searching in is uppercased and then the search is performed case-sensitively.

While if we go for the non-default “compare in uppercase” the string is not changed and if there is a case-sensitive match, we get that result back.

In RDMLX we have a couple of alternatives which seem a lot simpler, all explicitly case sensitive:
STRING.Contains(SEARCHSTRING) (returns true or false)
STRING.PositionOf(SEARCHSTRING) (returns position of match)
SEARCHSTRING.PositionIn(STRING) (returns position of match)

I miss regular expressions.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s