Re: TIDs case insensitive?
Re: TIDs case insensitive?
- Subject: Re: TIDs case insensitive?
- From: Bill Briggs <email@hidden>
- Date: Tue, 6 Mar 2001 16:24:34 -0400
At 9:32 AM -0800 06/03/01, Chris Nebel wrote:
> I just found to my great dispair that TIDs are case sensitive. Is
there a way to make them insensitive? - no, not ignoring case, I
just tried...
I use TIDs for fast substring replacements. If I cant' make them
case insensitive, I will have to use more traditional and less
efficient search/replace.
Sorry, it's a known problem with no workaround in plain AppleScript.
Don't apologize. It can actually be useful. I wouldn't want that
fixed if it meant that an "A" was no longer just an "A", but could be
an "a" as well. IMHO it would be better that they stay strict
character designations. What Serge wants to do is a job for GREP.
Most people don't notice because their delimiters are all punctuation.
But a script like this would break if it was case insensitive. And
it's a lot faster way of doing something like this than going about
an ASCII character mapping (and is easier to program where the
Majiscule/Miniscule forms are in non-english alphabets that don't
have neat mappings for letters with diacritical marks).
set xMay to "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
set xMin to "abcdefghijklmnopqrstuvwxyz"
set capVar to "ThisIsTheSampleStringToBeTransformed"
set astid to AppleScript's text item delimiters
considering case
repeat with xChar from 1 to length of xMay
set AppleScript's text item delimiters to ,
{"" & item xChar of xMay}
set capVar to text items of capVar
set AppleScript's text item delimiters to ,
{"_" & item xChar of xMin}
set capVar to capVar as string
end repeat
set newVar to capVar
set AppleScript's text item delimiters to astid
end considering
newVar
Please don't make Text item delimiters case insensitive. I think
they are more useful the way they are. Something that *would* be
useful is to have multiple defined TIDs actually working.
- web