AppleScript text extraction

I have a column in apple numbers and each cell have different values like "1 oz" or "1/2 part". How can I remove the text and keep only the number part of the text? So "1 oz" would become only "1" or "1/2 part" whould be only "1/2"?
Accepted Answer
My weapon of choice for this is text item delimiters. For example:

Code Block
set text item delimiters to " "
set s to "30 grams"
text item 1 of s -- returns "30"


Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
AppleScript text extraction
 
 
Q