Javascript examples for String:split
Split and break up a string every X amount of characters
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=( function() {//from w ww. j a v a2 s .c o m function splitInto(str, len) { var regex = new RegExp('.{' + len + '}|.{1,' + Number(len-1) + '}', 'g'); return str.match(regex ); } document.write.call(document, splitInto('12345678909876754432321', 3).join('<br>')); }); </script> </head> <body> </body> </html>