• 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: text to list
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: text to list


  • Subject: Re: text to list
  • From: Paul Berkowitz <email@hidden>
  • Date: Sun, 01 Dec 2002 10:50:26 -0800

On 12/1/02 9:20 AM, "Michelle Steiner" <email@hidden> wrote:

> If you're trying to remove the zeros, then it's just a bit more complex:
>
> set text item delimiters to {"0"}
> set foo to text items of "102030405060708090"
> set text item delimiters to {""}
> foo
> --> {"1", "2", "3", "4", "5", "6", "7", "8", "9", ""}
>
> A little touch up is necessary to remove that final empty string,
> caused by that final zero.
>
> set theString to "102030405060708090000"
>
> repeat while the last character of theString is "0"
> set theString to text 1 through -2 of theString
> end repeat

Hmmm. None of us have thought about "real" zeroes appearing as "000"; i.e..
a 'real' zero appearing between other integers. If John has any of those,
all our methods will produce {"8", "9", "", "1", "2"} etc. You can get rid
of all of those by first checking for "00" as follows. It will take care of
any final sequence of zeroes as well, plus any longer set such as
"100000002":

set {oldTIDs, AppleScript's text item delimiters} to {AppleScript's text
item delimiters, {"00"}}
try
set a to text items of theText
on error
set a to my LargeTidsList(theText, "00")
end try
set AppleScript's text item delimiters to {""}
set theText to b as string
set AppleScript's text item delimiters to {"0"}
try
set a to text items of theText
on error
set a to my LargeTidsList(theText, "0")
end try
set AppleScript's text item delimiters to oldTids
return a


on LargeTidsList(theText, tid)
--etc., from last post
end LargeTidsList(theText, tid)


--
Paul Berkowitz
_______________________________________________
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: text to list
      • From: Malcolm Fitzgerald <email@hidden>
References: 
 >Re: text to list (From: Michelle Steiner <email@hidden>)

  • Prev by Date: Re: text to list
  • Next by Date: Re: The System Preferences Pains and setting display resolution (OS X 10.2.2)
  • Previous by thread: Re: text to list
  • Next by thread: Re: text to list
  • Index(es):
    • Date
    • Thread