Re: numbers in a variable.
Re: numbers in a variable.
- Subject: Re: numbers in a variable.
- From: Paul Skinner <email@hidden>
- Date: Thu, 31 Jul 2003 17:29:46 -0400
On Thursday, July 31, 2003, at 03:51 PM, kai wrote:
SNIP
set sampleText to "Printers
1 HP laserjet
2 HP inkjet
3 Canon color
Plotters
4 xerox
5 oce"
set {itemList, hdngList, numStr} to {{}, {}, "1234567890"}
repeat with newLine in sampleText's paragraphs
tell newLine's contents to if its character 1 is in numStr then
set itemList's end to it
else
set hdngList's end to it
end if
end repeat
{itemList, hdngList}
--> {{"1 HP laserjet", "2 HP inkjet", "3 Canon color", "4 xerox", "5
oce"},{"Printers", "Plotters"}}
Kai,
I love terse, but...
tell newLine's contents to if its character 1 is in numStr then
Whew!
It's like that bit of the pork chop that you just can't chew up!
Is there any advantage to that method over the less obsfucated ...
set sampleText to "Printers
1 HP laserjet
2 HP inkjet
3 Canon color
Plotters
4 xerox
5 oce"
set {itemList, hdngList, numStr} to {{}, {}, "1234567890"}
repeat with newLine in sampleText's paragraphs
set newLine to newLine's contents
if character 1 of newLine is in numStr then
set itemList's end to newLine
else
set hdngList's end to newLine
end if
end repeat
{itemList, hdngList}
-->{{"1 HP laserjet", "2 HP inkjet", "3 Canon color", "4 xerox", "5
oce"}, {"Printers", "Plotters"}}
PS
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.