uppercase-lowercase in coldfusion

Hello experts.
How can i store in my database a string with the first letter-uppercase and the rest lowercase,whatever a client is writing in my form.firstname field.
The one i have is changing everything to lowercase like:
<cfset FirstName = rereplace(lcase(form.Firstname), "((^| )[a-z]{1})", "\U\1", 'all' )>

Any help?(please a none javascript solution)
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gurpreet Singh RandhawaCEOCommented:
u can use the cflib.org udf

try this one: http://cflib.org/udf/nameCase

or this one: http://cflib.org/udf/upperFirst

Whichever serves your best purpose!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PanosAuthor Commented:
How can i use this out of a cffunction
I have an insert querylike
 (<cfif  Form.Firstname NEQ "">
<cfset FirstName = rereplace(lcase(form.Firstname), "((^| )[a-z]{1})", "\U\1", 'all' )>
   <cfqueryparam cfsqltype="cf_sql_varchar" value="#Firstname#">,<cfelse>NULL,</cfif> .......
Gurpreet Singh RandhawaCEOCommented:
u can use them inside the insert query like:

you should call this template as an include file like:

<cfinclude template="upperFirst.cfm">


 (<cfif  Form.Firstname NEQ "">
   <cfqueryparam cfsqltype="cf_sql_varchar" value="#upperFirst (Firstname)#">,<cfelse>NULL,</cfif> .......

That's ALL you have to do
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

Gurpreet Singh RandhawaCEOCommented:
this should <cfqueryparam cfsqltype="cf_sql_varchar" value="#upperFirst (Firstname)#">,<cfelse>NULL,</cfif> .......
be as
<cfqueryparam cfsqltype="cf_sql_varchar" value="#upperFirst (form.Firstname)#">,<cfelse>NULL,</cfif> .......
PanosAuthor Commented:
Hi again.
You have answered my question.I have a little problem now because i'm not using the english language and characters but the greek one.
The function i need is the nameCase function but that is changing the last letter in my string.
I can't write it down because none english characters can not be displayed.Have you any idea to solve this?
Gurpreet Singh RandhawaCEOCommented:
well i do not know but i think if u website is in greek language, then u need the find the equivalent of


in greek language..

like u can use google:

([[: ¿¿¿ :]])([[: ¿¿¿ :]]*)"," \ 1 \ L \ 2 \ ¿ "

i am not sure but it may work!

here is the link that i tried

PanosAuthor Commented:
No this is not solving the problem.Using the new code i get all uppercase.
This is the case where one problem is solved and the next one comes and again i stuck.
I will accept the first answer and make a new question for the new peoblem.
Thank you
PanosAuthor Commented:
Thak you.
PanosAuthor Commented:
Finally i found a solution without problems here:
      <cffunction name="initCap" access="public" output="false" returntype="String" hint="I capitalize the first letter of every word group">
              <cfargument name="inputString" required="false" type="String" default="" />
              <cfreturn rereplace(lcase(arguments.inputString), "(\b\w)", "\u\1", "all") />
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.