Search and Replace in String
Search and Replace in String
- Subject: Search and Replace in String
- From: André Renault <email@hidden>
- Date: Sat, 17 Jul 2010 14:58:54 +0200
Hey y'all
I discovered a hack to search and replace inside a string. It involves using text item delimiters to do the job.
on searchAndReplace(strToLookIn, searchStr, replaceStr)
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to searchStr
set strToLookIn to every text item of strToLookIn
set AppleScript's text item delimiters to replaceStr
set strToLookIn to strToLookIn as string
set AppleScript's text item delimiters to tid
return strToLookIn
end searchAndReplace
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden