Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search for "." and remove characters

Status
Not open for further replies.

CFdutch

Programmer
Nov 12, 2003
49
0
0
NL
Hi,

I want to check if someone filled in a dot (".") in a specific formfield. If someone fills in test.com, I want to remove the .com piece...

The size is variable it could be for instance 100 characters or 3 chars. Has this something to do with the Eval() function??

Thanks in advance

Some people can learn, some people can teach.
 
<CFSET formfield=Replace(formfield,".","",ALL)>
should be <CFSET formfield=Replace(formfield,".","","ALL")>
Thanks ;-)

But now I've still got the text behind the, that now is attached to the text before the dot... How can I remove that??

Some people can learn, some people can teach.
 
Rudy, he wants to remove everything after the dot as well.

CFDuch eval() is a JS function Evaluate() is the CF version but is not what you want.
if you want to do this client side visit the JS forum
if you want a server side solution try this

<cfset formfield=listFirst(formfield, ".")>
will give you everything before the . assuming they only put in one .
if they put in you will get www

you may want to trap and see how many .'s they put in

<cfif listLen(formField,".") eq 2>
<cfset formfield=listFirst(formfield, ".")>
<cfelse>
tell user they messed up
</cfif>

Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so.
-Douglas Adams (1952-2001)
 
Thanks bombboy!

That was what I was looking for!
I'll build in a extra validation to remove the if it's there.

Some people can learn, some people can teach.
 
glad to help.

Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so.
-Douglas Adams (1952-2001)
 
doh! just another example of my less than perfect record

nice solution, tra.., er, bombboy

:)

rudy
SQL Consulting
 
don't feel bad. when it comes to SQL your record is a WHOLE lot better than mine. :)

Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so.
-Douglas Adams (1952-2001)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top