if this has to be imported somewhere else you need to consider, what happens
if your delimiter is in a piece of text?

On Sun, Jun 7, 2009 at 2:25 PM, Angelo Anolin <[email protected]>wrote:

>
>
> Hi Tim,
>
> Thanks for the tip(s). Was able to make this thing work out.
>
> Regards,
>
> Angelo
>
> ------------------------------
> *From:* Tim Hoff <[email protected]>
> *To:* [email protected]
> *Sent:* Friday, 5 June, 2009 14:05:46
> *Subject:* [flexcoders] Re: ArrayCollection to Delimited String
>
>  Well, let's not assume anything:
>
> private *function* parseArrayCollectio n():*void*
> {
>      *var* myString:String = *""*;
>
>      *for* *each* ( *var* myObject:Object *in* myAC )
>      {
>           myString += myObject.label + *"|"* + myObject.data + *"||"*;
>      }
> *
>      trace*(myString);
> }
>
> -TH
>
>
> --- In flexcod...@yahoogro ups.com, "Tim Hoff" <timh...@...> wrote:
> >
> >
> > Assuming that you don't want the trailing pipes:
> >
> > private function parseArrayCollectio n():void {
> >
> >
> >
> > var myString:String = "";
> >
> >
> >
> > for each ( var myObject:Object in myAC )
> > {
> > myString += myObject.label + "|" + myObject.data;
> >
> > if ( myAC.getItemIndex( myObject ) < myAC.length - 1 )
> > {
> > myString += "|";
> > }
> > }
> >
> > trace(myString) ;
> > }
> >
> > -TH
> >
> > --- In flexcod...@yahoogro ups.com, Angelo Anolin angelo_anolin@
> > wrote:
> > >
> > > Hi FlexCoders,
> > >
> > > Supposed I have an ArrayCollection variable represented like below:
> > >
> > > <mx:ArrayCollection id="myAC">
> > > <mx:Array id="myArray">
> > > <mx:Object label="MI" data="Lansing" />
> > > <mx:Object label="MO" data="Jefferson City"/>
> > > <mx:Object label="MA" data="Boston" />
> > > <mx:Object label="MT" data="Helena" />
> > > <mx:Object label="ME" data="Augusta" />
> > > <mx:Object label="MS" data="Jackson" />
> > > <mx:Object label="MN" data="Saint Paul"/>
> > > </mx:Array>
> > > </mx:ArrayCollection>
> > >
> > > I want to store the same in a String variable where the resulting
> > string would be like:
> > >
> > > var ResultString: String;
> > > ResultString = "MI|Lansing| |MO|Jefferson
> > City||MA|Boston| |MT|Helena| |ME|Augusta| |MS|Jackson| |MN|Saint Paul||"
> > >
> > > How do I achieve this?
> > >
> > > Inputs highly appreciated. Thanks.
> > >
> > > Regards,
> > >
> > > Angelo
> > >
> >
>
>  
>



-- 
j:pn
\\no comment

Reply via email to