How to use stringtokenizer in javascript?

Posted on 2006-04-04
Last Modified: 2009-12-16

Is there anyway i can tokenize string using javascript?
If you have written your own method.. also it will be appreciated?

Ravindra N
Question by:getravi2k

    Accepted Solution

    Hey Ravindra,

    you can;

    var myArray = myString.split(",");

    myArray will store an array of values split on the delimiter chat (shown above as a comma).

    You can of course then iterate through the array to retrieve the value of each array element:

    for (var i = 0 ; i < myArray.length ; i++){
    LVL 6

    Expert Comment


    Expert Comment

    sorry I typed 'delimiter chat' but of course meant delimeter 'char'

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
    Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
    This video teaches users how to migrate an existing Wordpress website to a new domain.
    The viewer will learn how to dynamically set the form action using jQuery.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now