[comp.sys.mac.hypercard] Problem with string compares

psych@watserv1.waterloo.edu (R.Crispin - Psychology) (12/07/90)

I seem to have run across a string comparison problem with HC 2.0.
do the following
  put "123Y4567Y890Y..." into strA

 put "123Y456Y..." into strA
 put numtochar(217) into strB
 -- this can be generated using option shift `
 -- it shows up as various characters depending on the font
 put offset(strB,strA) into s

s will have the value 3. It seems theat HC maps strings into standard
ASCII characters (7 bits instead of 8) before it does the comparison.
I had no end of problems with this. The only solution I have found to
this is to convert the 2 strings to there number formats and then to 
compare them. This only works for single characters. I end up doing 
something like this:

 put "123Y456Y890Y..." into strA
 put numtochar(217) into strB
 put offset(strB,strA) into s
 if chartonum(strB) = chartonum(char s of strA) then
 
This works but is not very nice. I checked the meager docs that I have
and could not find any reference to this sort of thing happening. If
anyone has a better work around for this I would like to hear from you.
Part of the problem is that the Mac incourages the use of all these
special characters with the option key. I don't know why HC doesn't 
support them fully. They can be entered into fields and text strings
but you then can't compare them. This is silly. 
Please email to one of the addresses below.
 
Thanks

Richard Crispin              Phone:    (519)888-4781
Dept. of Psychology          Bitnet:   psych@watdcs 
University of Waterloo       Internet: psych@watserv1.UWaterloo.ca 
Waterloo, Ont.   Canada   N2L 3G1