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

Re: Split string


  • Subject: Re: Split string
  • From: Hanaan Rosenthal <email@hidden>
  • Date: Mon, 15 Mar 2004 19:53:06 -0500

Hello Gvtz,

Using the 'words of' term you are counting on AppleScript's arbitrary
(as it may appear) method of splitting strings, omitting punctuation,
etc.
You should instead use delimiters that you set yourself:

set text item delimiters to "/"
text items of "400/500 1000"
--> {"400", "500 1000"}

or

set text item delimiters to " "
text items of "400/500 1000"
--> {"400/500", "1000"}

At the end, make sure to reset:
set text item delimiters to ""

and, when working inside application tell blocks, use this line:
set applescript's text item delimiters to " "

Hanaan


On Mar 12, 2004, at 5:46 AM, Gvtz Verdieck wrote:

> Hallo,
>
> please have a look at the following script:
>
> set spg_yvsty to "300 1000"
> class of spg_yvsty -- output: string
> set wd to word 1 of spg_yvsty -- output: 300
> count words in spg_yvsty -- output: 2
> set spg_erdkabel to "400/500 1000"
> class of spg_erdkabel -- output: string
> set wd2 to word 1 of spg_erdkabel -- output: 300 but I would like to
> see :
> 300/500
> count words in spg_erdkabel -- output: 3
>
>
> I don9t understand why / is a so special character in a string ?
> Can someone help me to get the result 300/500 from spg_erdkabel.
> How can I set the word separater only to ' ' ?
>
> Any tip is welcome.
>
> Gvtz
> _______________________________________________
> 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.
>
>
--
Hanaan Rosenthal * Custom Flow Solutions
MEDIA AUTOMATION CONSULTING
401-487-2957 * email@hidden
* www.customflowsolutions.com *

be successful... ...work less.
_______________________________________________
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.


References: 
 >Split string (From: Götz Verdieck <email@hidden>)

  • Prev by Date: Re: applescript to get system version
  • Next by Date: how to eject a firewire drive natively
  • Previous by thread: Re: Split string
  • Next by thread: Thanks for the help
  • Index(es):
    • Date
    • Thread