How to replace strings in AppleScript

E.g. replace all newline and linefeed characters by one space character:

set AppleScript's text item delimiters to {return, linefeed}
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 {""}