Re: applescript-users digest, Vol 3 #672 - 16 msgs
Re: applescript-users digest, Vol 3 #672 - 16 msgs
- Subject: Re: applescript-users digest, Vol 3 #672 - 16 msgs
- From: "Marc K. Myers" <email@hidden>
- Date: Wed, 31 Jul 2002 13:53:23 -0400
- Organization: [very little]
>
From: email@hidden
>
Date: Wed, 31 Jul 2002 03:36:47 EDT
>
Subject: Today's Question - poke a character in a string
>
To: email@hidden
>
>
I'm working with long strings (400 to 4000 characters),
>
searching for occurances of specific symbols, such as
>
double-greater-than (ASCII 200) and replacing them with
>
greater than symbols.
>
>
Is there a way to tell AppleScript to
>
>
set character 400 of MyLongString to ">"
>
>
instead of going:
>
>
set MyLongString to (characters 1 thru (CurrentIndex-1) of MyLongString) &
>
">" & (characters (CurrentIndex+1) thru end of MyLongString) as string
If you want to change all occurrences in the string, this is the easiest
way I know:
set theString to "abcdefg[dbl-">"]hijklmn[dbl-">"]opqrstu[dbl-">"]vwxyz"
set dblGT to ASCII character 200
set {od, AppleScript's text item delimiters} to [optn-L]
{AppleScript's text item delimiters, {dblGT}}
set theString to text items of theString
set AppleScript's text item delimiters to {">"}
set theString to (theString as text)
set AppleScript's text item delimiters to od
theString
-->"abcdefg>hijklmn>opqrstu>vwxyz"
NB: characters that don't transmit well have been replaced by other representations
Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[7/31/02 1:52:39 PM]
_______________________________________________
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.