Find/Replace in Lists

Hello,

I am new to Applescript, and scripting in general. I am looking for a way to find and replace strings in a list.

For example, let’s say I want to find all instances of “Item” in the following list and replace them with the word “Datum” while preserving any other strings in the list entries.

{“Item 1”,“Item 2”,“Item 3”, “Cat”} becomes {“Datum 1”,“Datum 2”,“Datum 3”,“Cat”}

Any advice on how to accomplish this? Apologies if this has been covered.

Thanks,
RJ

Check this out: str_replace()

You would use something like this to call it:

str_replace("Item", "Datum", {"Item 1", "Item 2", "Item 3", "Cat"})

That works perfectly. I had problems with some other search/replace scripts, I think because they weren’t specifically set up to deal with lists, only strings. Thanks!