Replace this in variable to that...

This may seem like a n00b question but I have never used something like this, what I need is some AS that can do something like this…

set myVar to ""
replace "." in myVar with " "
return myVar

what should be returned is “abc abc abc”.
Thanks in advance if anyone can help.

Hi Captain,

text item delimiters are your friend

set myVar to replaceText("", ".", space)

on replaceText(theText, fromDelim, toDelim)
	set {TID, text item delimiters} to {text item delimiters, fromDelim}
	set theText to text items of theText
	set text item delimiters to toDelim
	set theText to theText as Unicode text
	set text item delimiters to TID
	return theText
end replaceText