Re: character (Offset of stringA in stringB) of stringB
Re: character (Offset of stringA in stringB) of stringB
- Subject: Re: character (Offset of stringA in stringB) of stringB
- From: Paul Berkowitz <email@hidden>
- Date: Sun, 29 Dec 2002 15:01:49 -0800
On 12/29/02 2:37 PM, "Matthew Stuckwisch" <email@hidden> wrote:
>
Has anyone else found that, when working with Unicode strings (here we
>
go again...) that if you were to, say, load three files, on a document,
>
and the other two being a list of characters, one a scrambled version
>
of the other, and try to replace the document's characters based on the
>
other two files (basically, a cryptoquote deal), either "character" or
>
"offset" doesn't work properly?
>
>
In trying to figure this, I literally came into a situation like the
>
following:
>
>
A = character (offset of A in B) of C -- A _is_ in B, and B=C
>
--> False
>
>
Logically speaking, I see no reason that this should happen. Worst of
>
all, it only fails on about half the runs, so when looping through a
>
text file coding it up, half the characters end up correctly, the other
>
half do not. Perhaps I've missed something?
1. Don't use 'offset'. It's a pain. Find a better way to do text searching.
2. What exactly do you get for 'offset of A in B' in this particular case?
3. Note that 'offset', like 'text item delimiters' is case-sensitive.
To the point:
4. Maybe 'character x of someText' converts to (international) string, so
when you compare it with the original Unicode, they may not be the same.
If you can convert the original to string, try that. If you can't, because
you need the Unicode, instead of 'character x of someText', try 'text x thru
x of someText' and even add 'as Unicode text' if necessary, although I don't
think it should be.
Hopefully it's not a bug with offset. According to Standard Additions 1.9.1:
offset
of Unicode text -- the source text to find the position of
in Unicode text -- the target text to search in
Result: integer -- the position of the source text in the target, or 0
if not found
so it is meant to work with Unicode.
--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.