• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Strip characters without recursive loop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strip characters without recursive loop


  • Subject: Re: Strip characters without recursive loop
  • From: Jean-Baptiste LE STANG <email@hidden>
  • Date: Tue, 19 Aug 2003 10:20:10 +0200

Using satimage osax, you can do :

change "[^(1-9)]" into "" in "aze213aze456" with regexp
--> "213456"
@+ JB


Le mardi, 19 ao{ 2003, ` 10:10 Europe/Paris, David Hood a icrit :

On Tuesday, August 19, 2003, at 01:52 PM, Duncan Cowan wrote:
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


well, I don't know if it's faster than your particular loop but

set theString to "1234-56abc"
set theStringVersion2 to quoted form of theString
set shellstring to "echo " & theStringVersion2 & " |sed 's/[^0123456789]//g'"
set theResult to do shell script shellstring

seems to work,


David Hood
_______________________________________________
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.
_______________________________________________
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.

  • Follow-Ups:
    • Re: Strip characters without recursive loop
      • From: Duncan Cowan <email@hidden>
    • Re: Strip characters without recursive loop
      • From: Emmanuel <email@hidden>
References: 
 >Re: Strip characters without recursive loop (From: David Hood <email@hidden>)

  • Prev by Date: Re: Strip characters without recursive loop
  • Next by Date: Re: Weird Finder bug - or not?
  • Previous by thread: Re: Strip characters without recursive loop
  • Next by thread: Re: Strip characters without recursive loop
  • Index(es):
    • Date
    • Thread