Re: Error trap if item cannot be made into an integer?
Re: Error trap if item cannot be made into an integer?
- Subject: Re: Error trap if item cannot be made into an integer?
- From: "Donald S. Hall" <email@hidden>
- Date: Tue, 19 Nov 2002 22:08:51 -0700
>
I'm looping through items in a list and I want to skip the item if the item
>
name can't be made into an integer. What's the syntax to trap the "Can't
>
make into an integer" error?
Try this:
if isInteger(someItem) then
-- do your thing with someItem
else
-- do whatever if it's not an integer
end if
on isInteger(anItem)
try
anItem as integer
return true
on error
return false
end try
end isInteger
Hope this helps,
Don
--
Donald S. Hall, Ph.D.
Apps & More Software Design, Inc.
http://www.theboss.net/appsmore
email@hidden
_______________________________________________
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.