Archive

Archive for September, 2011

split a string at every n-th character in javascript

September 27, 2011 Comments off

Syntax:

String.match(/.{1,n}/g);

Command:

“testing”.match(/.{1,2}/g);

Output:

te st in g

Advertisements
Categories: JavaScript, Technical