• 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: item delimiters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: item delimiters


  • Subject: Re: item delimiters
  • From: Gary Lists <email@hidden>
  • Date: Thu, 29 May 2003 17:02:13 -0400

On or about 5/29/03 3:40 PM, Ruby Madraswala wrote:

> Hi all,
>
> I have this script which works in some instances and all (OS 9.2):
> Searches the file for keyword "SIZES" and counts number of pipes in that line.
>
> Set keyword to "SIZES"
> Set filedata to read alias myfile
> Set {olddelims, text item delimeters} to {text item delimiters, keyword}

Typo in spelling (email only? wouldn't compile otherwise, so not tested...?)

> Set target line to paragraph 1 of item 2 of (text items of filedata)
> Set text item delimiters to "|'

Unbalanced quote.

> Set pipecount to (count text items of targetline) - 1
>
> Ex:
> SIZES|1|2|3|4 returns the correct value of 4
> SIZES|1-2|3-4|5-6 returns 0 should return 3, only difference is the hyphen.
>
> How can I get this to work in all scenarios and also I want to add an error
> message in case the keyword 'SIZES" is not found.


Seems like an overly lengthy approach, with lots of 'text items of'.

How about this, which I only tested for two strings (the ones you supplied).

set myData to "SIZES|1-2|3-4|5-6"
set text item delimiters to "|"
set countPipes to ((count text items of myData) - 1)
-- 3


May or may not handle "....|" entries and "|..." entries, if any.


> Thanks in advance.
>
> Ruby
> _____


--
Gary


Please reply directly to the list.
Incoming messages are auto-deleted. (It's anti-spam, that's all.)
_______________________________________________
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.

  • Prev by Date: (OFF) A Partial Cure ?
  • Next by Date: Re: Coding Help
  • Previous by thread: item delimiters
  • Next by thread: Item delimiters
  • Index(es):
    • Date
    • Thread