Apple Script replace
I got a quck AppleScript question for anyone with an aswer
I have a script in which the variable may contain a space " " such as "dog and cat"
How would I go about having the script read the data and replace it with another character(s) such as "dog$and$cat"?
probably the easiest way would be to use delimiters to mark the space characters & replace them with "$" characters...
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>set thedata to <font color = red>"dog and cat"</font>
set the text item delimiters to <font color = red>" "</font>
set datalist to text items of thedata as list
set the text item delimiters to <font color = red>"$"</font>
set thenewdata to datalist as string
-- <font color = red>"dog$and$cat"</font>
set the text item delimiters to <font color = red>""</font></font>[/code]
this would just create a list of the individual characters in the string & replace all the " "'s with "$"'s, then convert the list back to a string (thenewdata).
|All times are GMT -4. The time now is 07:23 AM.||
Copyright © 2005-2007 MacNN. All rights reserved.
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2014, vBulletin Solutions, Inc.