I have an Automator Service that is comprised of a single "Run AppleScript" action. The Service receives selected
The Service incorporates this selected text into a pre-determined URL format. The Service then opens the newly-assembled URL in a new tab in a web browser window.
Here is a string that the Service might receive:
My Plant's Dead! (But, Who Cares? I Have 12 Plants.)
I want to use AppleScript to remove every and any punctuation symbol that exists in the string, including spaces. I also need the string to be converted to all lowercase characters. Numbers should not be removed from the string.
So, the desired string is:
I understand that I can accomplish the desired effect by writing an individual
text item delimiters statement for every possible punctuation symbol and for 26 uppercase letters. I could use a
replace_characters sub-routine to make this method a bit neater.
Is there an easier or shorter way to accomplish this effect in AppleScript, as opposed to using dozens of
text item delimiters blocks? Such as, one line of code that reduces a string to letters?
I know that other programming languages have a "strip punctuation" shortcut, which is why I ask.
This is, essentially, an AppleScript-specific "Code Golf" question.