Re: Strip characters without recursive loop
Re: Strip characters without recursive loop
- Subject: Re: Strip characters without recursive loop
- From: David Durkee <email@hidden>
- Date: Tue, 19 Aug 2003 10:21:09 -0500
Not to be pedantic (well, maybe), but your use of "recursive" in the
subject is incorrect. A function is recursive if it calls itself. The
most common example of this you would be likely to find in AppleScript
is code that does something with every file in a folder and all of its
subfolders to any depth. A recursive way of doing what you describe
would be a routine that looks like this (pseudocode):
on StripUnwantedChars(myString)
if unwanted character found in myString
remove unwanted character from myString -- just removes one
unwanted character
set myString to StripUnwantedChars(myString)
end if
return myString
end StripUnwantedChars
The handler keeps calling itself until no unwanted characters are
found. This would be a very bad approach to solving this problem.
I think the word you wanted was "iterative", but "iterative loop" is
redundant.
David
On Monday, August 18, 2003, at 08:52 PM, Duncan Cowan wrote:
Hi List
Is it possible to string all non numerical characters from a string,
without
looping through each character?
I realise that this is probably not possible.... but it would make my
script
run a lot quicker.
Example:
set theString to "1234-56abc"
set theResult to characters of the string whose kind is integer
Just hoping to save a bit of time.
Thanks in advance
D
_______________________________________________
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.
--
David Durkee
email@hidden
<
http://ddurkee.homeip.net/>
_______________________________________________
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.