character substitutions

hello all, i hope this is not something that has been recently answered… but i’d like to write a script that will translate a text document, character(s) to different character, to a new text document. it seems like i’m getting real close, looking into text-manipulation and the like, but i could really use a hint in the right direction. i’m hoping something like this is possible with applescript, if not, what? thank you so much for your help, tis greatly appreciated.

Would something like this work for you?

display dialog Replace("jam and bacon", "a", "1")
-- returns "j1m 1nd b1con"

display dialog Replace("Hot hotel", "ho", "ABC")
-- returns "ABCt ABCtel"

on Replace(inputString, findString, replaceString)
	set memory to AppleScript's text item delimiters 
	set AppleScript's text item delimiters to {findString}
	set subStringlist to text items of inputString
	set AppleScript's text item delimiters to {replaceString}
	set retVal to subStringlist as string
	set AppleScript's text item delimiters to memory
	return retVal
end Replace