OK I have scripted some on the windows side of the world and I have a current project that I am doing to learn a little more about Applescript. I have the need to manipulate some strings and I have found that none of my previous experiance with parsing strings is helping much.
I have strings like the one below as well as others but they all have a colon in the text. I need to extract the room number which may be three to four digits in length.
“Room Number: 001”
Any good primers on string manipulations out there?
assuming that the whitespace contains only space characters, try this
set aString to "Room Number: 001"
set {TID, text item delimiters} to {text item delimiters, ":"}
set aString to text item 2 of aString
set text item delimiters to space
set aString to last text item of aString
set text item delimiters to TID
display dialog aString
set aString to "Room Number: 001"
set {TID, text item delimiters} to {text item delimiters, (":" & tab)}
set aString to text item 2 of aString
set text item delimiters to TID
display dialog aString