gal-s
2/2/2020 - 1:34 PM

Replace Screen function in AppleScript

on replace_chars(this_text, search_string, replacement_string)
	set AppleScript's text item delimiters to the search_string
	set the item_list to every text item of this_text
	set AppleScript's text item delimiters to the replacement_string
	set this_text to the item_list as string
	set AppleScript's text item delimiters to ""
	return this_text
end replace_chars

set theText to "gal sarig gal sarig"
set newText to replace_chars(theText, "gal", "adar")
log "newText=" & newText