Re: Reformatting a string
Re: Reformatting a string
- Subject: Re: Reformatting a string
- From: Jon Pugh <email@hidden>
- Date: Fri, 27 Jan 2012 11:17:36 -0800
On Jan 27, 2012, at 10:07 AM, Angelo wrote:
> I need to take a long string string of letters numbers and colons and convert it to uppercase letters w/ no colons.
> a2:fh:2f:vv:i1:q1 needs to be A2FH2FVVI1Q1. (the string is normally longer that this example)
>
> I currently slap it into a new Mail document and “Transform” to uppercase and then “Find” the colons and replace with nothing. That works OK,
> but I know it’s archaic and one of you guys could craft a script in a few minutes that would take me a few hours to create. I was thinking along the lines of a dialog box where I pasted the raw string and it produced a message box with the reformatted version, but anything would be helpful. Is it possible to copy the string and then do the reformatting to the contents of the Clipboard so that I can just copy -> run script -> paste where it needs to go?
Another opportunity to flog the power of SmartString:
property ss : load script file ((path to application support from user domain as string) & "Script Debugger:Script Libraries:SmartString.scpt")
set t to the clipboard
tell ss's SmartString
setString(t)
replaceStrings(":", "")
uppercase()
set t to getString()
end tell
set the clipboard to t
Fast and easy.
SmartString source is here: http://www.seanet.com/~jonpugh/software/SmartString.applescript
Current version is 1.10.0 since I just added a SmartenQuotes routine.
Jon
_______________________________________________
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