• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 10571
  • Last Modified:

How to use stringtokenizer in javascript?

Hi,

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

Regs,
Ravindra N
0
getravi2k
Asked:
getravi2k
  • 2
1 Solution
 
jonlondon12Commented:
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++){
           alert(myArray[$i]);
}
0
 
jonlondon12Commented:
sorry I typed 'delimiter chat' but of course meant delimeter 'char'
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now