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).