Re: If Statements
Re: If Statements
- Subject: Re: If Statements
- From: Peter Baxter <email@hidden>
- Date: Sat, 13 Sep 2008 08:46:23 +1000
I think that you want to use a subroutine to strip out all the non-
integer items in your passwords, leaving the numerical items which you
can then operate on. The following script would do this for you:
set the comparisonString to "0123456789"
set the sourceString to "PJB123"
set the newText to ""
repeat with x from 1 to the count characters in sourceString
set myInteger to character x of sourceString
if myInteger is in comparisonString then
set newText to newText & myInteger
end if
end repeat
display dialog newText
On 12/09/2008, at 3:22 PM, Tim Mansour wrote:
On 12/09/2008, at 3:13 pm, Ed Stockly wrote:
If userName were always a string, then
If (username > 1 and username <10)
would never work.
Or rather would work, but would return false.
As I interpret the OP, we can have
userName = "J Bloggs"
or
userName = "12345"
both of which are strings, but only the latter will coerce without
error to a number.
--
Tim Mansour <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript-
email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
_______________________________________________
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