• 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: Using Akua Sweets' "decompose"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using Akua Sweets' "decompose"


  • Subject: Re: Using Akua Sweets' "decompose"
  • From: "Marc K. Myers" <email@hidden>
  • Date: Sun, 17 Jun 2001 14:25:48 -0400
  • Organization: [very little]

Andy Wylie wrote:
>
> on 18/6/01 3:40 am, Marc K. Myers at email@hidden wrote:
>
> > Andy Wylie wrote:
> >> on 17/6/01 10:59 pm, Marc K. Myers at email@hidden wrote:
> >>
> >>> set theParams to (decompose theParams by "% = %" & return)
> >>>
> >>> The missing piece of the puzzle (for me) was that the percent sign
> >>> serves to delimit multicharacter delimiters from other delimiters in the
> >>> "by" string.
> >>
> >> Mark, I'd be inclined to 'munge' spaces from the 'key' and decompose with a
> >> single delimiter to avoid problems.
> >
> > By this do you mean that you'd modify the input text to convert " = " to
> > "=" before using the "decompose" on it?
> Yes
> > If so, what's the advantage?
> If erronous spaces don't end up in your list they end up in it's items
> that's all...
>
> set the_list to "bal = Baldo
> agn =Agnes
> bnk= Binky
> whp = Whoppo"
>
> set the_list to decompose the_list by "% = %" & return
> -- {{"bal = Baldo"}, {"agn =Agnes"}, {"bnk= Binky"}, {"whp ",
> "Whoppo"}}
>
> set the_list to munge the_list from {space, tab} to ""
> set the_list to decompose the_list by "=" & return
> -- {{"bal", "Baldo"}, {"agn", "Agnes"}, {"bnk", "Binky"}, {"whp",
> "Whoppo"}}


Andy -

Thanks for the quick response. I had thought of doing something like
that but was blocked by the possibility that some of the items to be
extracted from the text would themselves contain spaces (i.e. "bbl =
Beetle Bailey") and would get corrupted by simply munging out all the
spaces in the input text. That left me with doing a loop to change " ="
to "=" and "= " to "=" until there were no more equals signs with
leading or trailing spaces. I was unaware of the "munge" command in
Akua Sweets. That makes it much easier:

set theText to "bbl = Beetle Bailey"
repeat
set outText to munge theText from {" =", "= "} to "="
if outText = theText then
set theText to outText
exit repeat
else
set theText to outText
end if
end repeat
--> "bbl=Beetle Bailey"

Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074

[6/17/01 2:14:38 PM]


  • Follow-Ups:
    • Re: Using Akua Sweets' "decompose"
      • From: Andy Wylie <email@hidden>
  • Prev by Date: Re: Copying Resource Files ???
  • Next by Date: Re: Replacing Codes with Text
  • Previous by thread: Using Akua Sweets' "decompose"
  • Next by thread: Re: Using Akua Sweets' "decompose"
  • Index(es):
    • Date
    • Thread