14 Replies Latest reply on Jan 15, 2009 7:30 AM by kglad

    String splitting problem

    GerryIsHere Level 1
      Hi there,

      A PHP Script returns to Flash the following string:

      $flashstr .= $row ["lastName" ]." ".$row ["firstName" ].";";

      Variable name of the string in Flash is: myFriendsList
      It populates a Flash ComboBox which will be used to call some searches.

      Problem is how to split this string when it populates the CB.
      If I use it as is, splitted at the semi-colon, I get in my CB (for example):

      Adam John
      Le Baron Edward
      Ripley Shirley Mary Anne

      Seems simple, but to use this list and do the new search, the CB must send two variables: the Last Name and the First Name.
      And at this point I encounter some problems.
      For example:
      Adam (the Last Name) and John (the First Name). No Problem
      Le Baron (the Last Name which has TWO words in it) and Edward (the First Name). Problem!
      Ripley (the Last Name) and Shirley Mary Anne (the First Name which has THREE words in it). Problem!

      I think the best solution will be to split myFriendsList before it populates the CB in order to get two arrays: one for the Last Names and another for the First Names. I think it could be achieved by formatting the string at the PHP Level (sending) or at the AS Level (when receiving it).
      But I didn't do it right and got bad results...

      Any solution to submit ?

      Many thanks in advance for your help!