tokenize javascript string

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Obscurr

    tokenize javascript string

    I've got a long commaseparated string that I want to put into an
    array. Is thera an easy way of doing this with javascript? I think
    this is called tokenizing (?) but I couldn't find anything about it
    anywhere on the net.

    obs
  • Laurent Bugnion, GalaSoft

    #2
    Re: tokenize javascript string

    Hi,

    Obscurr wrote:
    [color=blue]
    > I've got a long commaseparated string that I want to put into an
    > array. Is thera an easy way of doing this with javascript? I think
    > this is called tokenizing (?) but I couldn't find anything about it
    > anywhere on the net.
    >
    > obs[/color]

    JavaScript has a nice method called "split()". It is so nice that it has
    been included into the .NET API too ;-)

    function makeArray( strLongString )
    {
    return strLongString.s plit( "," );
    }

    Laurent
    --
    Laurent Bugnion, GalaSoft
    Webdesign, Java, JavaScript: http://www.galasoft-LB.ch
    Private/Malaysia: http://mypage.bluewin.ch/lbugnion
    Support children in Calcutta: http://www.calcutta-espoir.ch

    Comment

    Working...