Jump to content


splitting a string into array in flex


4 replies to this topic

#1 456

    Young Padawan

  • Members
  • Pip
  • 5 posts

Posted 03 February 2009 - 09:00 PM

hye all!!could anyone out there help me.... :offtopic:

i got this line of codes in flex;
var queryStr:String = '127.0.0.1 - - [15/Sep/2008:10:37:14 -0700];
var params:Array = queryStr.split(" ");

i want to split them into array like this:127.0.0.1 [15/Sep/2008:10:37:14 -0700]
i know that i can use the "white space" as a delimiter in this case,but what i want to know is,where should i paste the above codes?whether it should be in the <mx:script> or what??other thing is,do i have to declare an array before i paste this codes?

thank you so much in advance.... :)

#2 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 04 February 2009 - 12:18 AM

I know nothing about flex, so i can't help you much, but perhaps this can:
http://livedocs.adob...ng.html#split()

#3 456

    Young Padawan

  • Members
  • Pip
  • 5 posts

Posted 04 February 2009 - 02:43 AM

actually i want to output this string "127.0.0.1 - - [15/Sep/2008:10:37:14 -0700]" into two columns using split function.can it be done??anyone out there who can help me with this... :offtopic:

thanks... :)

#4 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 04 February 2009 - 08:01 PM

Still, i know nothing about Flex, but if i understand you right, this should be what you want:
results = str.split(/(.*)- -(.*)/);
Regex :censored:

#5 456

    Young Padawan

  • Members
  • Pip
  • 5 posts

Posted 04 February 2009 - 10:15 PM

thanks to u..mission accomplish;problems solved!!! :censored:





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users