Change Case of first character of text string

Len Morgan len-morgan at crcom.net
Thu Feb 28 18:34:00 EST 2008


Is there a reason why you have to capitalize the first letter?  I have a 
similar feature in my software and I use something like:

SELECT * FROM people WHERE last_name ILIKE "smith"
That does a case insensitive search.

You could also use:

SELECT * FROM people WHERE tolower(last_name) = tolower('smith')

or you could try:

SELECT * FROM people WHERE last_name in ('Smith','SMITH','smith')


This assumes that you are using "standard" SQL (which your example is 
not).  Just a little "added" feature of my first example is you could use:

...WHERE last_name ILIKE 'smith%'  and get anyone who's name BEGINS with 
'smith' (for example Smithe, Smithy...)

Hope that helps.

len morgan

> Works great as long as the user enters the text string in the same case as
> has been entered in the database.  "Smith" = "Smith", but if the user enters
> "smith" in the select box, the record is not found.
>
> I want to do the database select with different text formats to make sure
> that the record is found.
> SELECT on "Smith", "smith", "SMITH"
>
> I found the toupper() and tolower() functions, but how do you get the
> function to change only the first letter toupper in a string?
>
> Thanks in advance for the help.  This cannot be that hard.
>   



More information about the use-livecode mailing list