Panos
asked on
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.First name), "((^| )[a-z]{1})", "\U\1", 'all' )>
Any help?(please a none javascript solution)
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.First
Any help?(please a none javascript solution)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
u can use them inside the insert query like:
you should call this template as an include file like:
<cfinclude template="upperFirst.cfm">
then
INSERT INTO.......
Values
(<cfif Form.Firstname NEQ "">
<cfqueryparam cfsqltype="cf_sql_varchar" value="#upperFirst (Firstname)#">,<cfelse>NUL L,</cfif> .......
That's ALL you have to do
you should call this template as an include file like:
<cfinclude template="upperFirst.cfm">
then
INSERT INTO.......
Values
(<cfif Form.Firstname NEQ "">
<cfqueryparam cfsqltype="cf_sql_varchar"
That's ALL you have to do
this should <cfqueryparam cfsqltype="cf_sql_varchar" value="#upperFirst (Firstname)#">,<cfelse>NUL L,</cfif> .......
be as
<cfqueryparam cfsqltype="cf_sql_varchar" value="#upperFirst (form.Firstname)#">,<cfels e>NULL,</c fif> .......
be as
<cfqueryparam cfsqltype="cf_sql_varchar"
ASKER
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?
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?
well i do not know but i think if u website is in greek language, then u need the find the equivalent of
([[:upper:]])([[:upper:]]* )","\1\L\2 \E"\
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
http://translate.google.co.in/translate_t?hl=&ie=UTF-8&text=([[:upper:]])([[:upper:]]*) %22,%22\1\ L\2\E%22&s l=en&tl=el #
([[:upper:]])([[:upper:]]*
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
http://translate.google.co.in/translate_t?hl=&ie=UTF-8&text=([[:upper:]])([[:upper:]]*)
ASKER
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
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
ASKER
Thak you.
regards
panos
regards
panos
ASKER
Finally i found a solution without problems here:
http://www.wecodethings.com/lore/idx.php/0/032/article/ColdFusion-Initcap-Capitalize-the-first-letter-of-each-word.html.
<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. inputStrin g), "(\b\w)", "\u\1", "all") />
</cffunction>
http://www.wecodethings.com/lore/idx.php/0/032/article/ColdFusion-Initcap-Capitalize-the-first-letter-of-each-word.html.
<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.
</cffunction>
ASKER
How can i use this out of a cffunction
I have an insert querylike
INSERT INTO.......
Values
(<cfif Form.Firstname NEQ "">
<cfset FirstName = rereplace(lcase(form.First
<cfqueryparam cfsqltype="cf_sql_varchar"