Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Seacrh For double Quotes with ListFindNoCase

Guest
Jul 28, 2011 Jul 28, 2011

My user entered  street names with double quotes and crashed my app.:

"32 street" instead of just 32 street.

I did not think of checking for double quotes at the time and I need to modify my codes now.

I need to find how many address entry has double quotes then produce a report so users can fix their feed.

I think my syntax below i wrong that's why I got error mesage from CF. Can anyone help with the right syntax on how to search a double quores in a string?

<CFIF ListFindNoCase(StreetName, " " ") NEQ 0>

  create report

</CFIF>

TOPICS
Getting started
947
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 28, 2011 Jul 28, 2011

First, you want to use contains, not ListFindNoCase.

Next, if the string you seek contains double quotes, use single quotes to quote the string, and vice versa.

Or, you can look for chr(34).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 13, 2011 Aug 13, 2011

GKiew wrote:

<CFIF ListFindNoCase(StreetName, " " ") NEQ 0>

  create report

</CFIF>

Almost.

<cfif findNoCase('"', streetname) NEQ 0> <!--- single quote, double quote, single quote, in that order, without spaces in between --->

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 13, 2011 Aug 13, 2011

My user entered  street names with double quotes and crashed my app.:

"32 street" instead of just 32 street.

I did not think of checking for double quotes at the time and I need to modify my codes now.

I need to find how many address entry has double quotes then produce a report so users can fix their feed.

Instead of "fixing" the data, why don't you fix your app so that the double quotes aren't a problem?  Don't treat the symptom: treat the problem.

--

Adam

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 13, 2011 Aug 13, 2011
LATEST

Adam Cameron. wrote:

My user entered  street names with double quotes and crashed my app.:

"32 street" instead of just 32 street.

I did not think of checking for double quotes at the time and I need to modify my codes now.

I need to find how many address entry has double quotes then produce a report so users can fix their feed.

Instead of "fixing" the data, why don't you fix your app so that the double quotes aren't a problem?  Don't treat the symptom: treat the problem.

--

Adam

I agree. Granted, it is often difficult, even impossible, to fix your application such that users will enter the kind of data you want. However, your application shouldn't crash because of bad user input. This suggests you should validate the form variables. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources