• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
weird comparison problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

weird comparison problem


  • Subject: weird comparison problem
  • From: Robert Brenstein <email@hidden>
  • Date: Mon, 26 Feb 2001 17:38:45 +0100

I have a script (this is a debug version) as part of my AppleScript-based cgi:

set tplSource to text of characters 5 thru (length of htmlTemplate) of
htmlTemplate
set n to the number of items in fieldNames
repeat with j from 1 to n
if item j of fieldNames is tplSource then -- !!!!!
if item j of fieldContents is "" then
set theResult to theResult & item j of fieldNames & " is " & tplSource &
return
return formatError(htmlTemplate & " refers to empty token (" & tplSource
& ")")
else
set theResult to theResult & item j of fieldNames & " is " & tplSource &
return
set htmlTemplate to item j of fieldContents
set tplSource to ""
exit repeat
end if
else
set theResult to theResult & "-" & item j of fieldNames & "- is not -" &
tplSource & "-" & return
end if
end repeat

This produces the following output

-to_address- is not -payment-
-subject- is not -payment-
-from_address- is not -payment-
-required_institute- is not -payment-
-required_address1- is not -payment-
-required_address2- is not -payment-
-required_country- is not -payment-
-required_phone- is not -payment-
-payment- is not -payment- <<<<<<<<<<
-Submit- is not -payment-
-cgi_version- is not -payment-
-client_ip_address- is not -payment-

The problem is that the line marked with <<<< fails the comparison (marked
with !!!!) even though the strings on both sides are identical. I checked
for invisible characters but can't see anything. I added the "-" to visibly
delimit the text.

NOW, if I change "is" to "begins with" *or* to "ends with" in the line
marked with !!!!s then the condition is met and I get:

payment is payment

But I need to check for equal! Anyone any ideas?

Robert


  • Follow-Ups:
    • Re: weird comparison problem
      • From: Emmanuel <email@hidden>
  • Prev by Date: Re: Applet's last command doesn't take
  • Next by Date: Re: File v. Folder
  • Previous by thread: Re: File v. Folder
  • Next by thread: Re: weird comparison problem
  • Index(es):
    • Date
    • Thread