A few words of thanks would be greatly appreciated.

Javascript - split ()

Strings play a very important role in programming and should be handled carefully to avoid getting any errors. Many programming languages like Strings have built in functions that help the user to modify a piece of string as per the requirements of the code. Strings has a built in split function which allows the user to subset a piece of string. Using the split function, one can extract multiple portions separately from a single piece of string.

The split () function allows you to split a string and return the results in a table, using a string defined as a separator.

In the example below, the split () can cut the date according to the character '/':

var date = '26/02/2009';  
var elem = uneDate.split('/');  
day = elem[0];  
month = elem[1];  
year = elem[2];

A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jeff Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.


This document, titled « Javascript - split () », is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).

1 Comment