jquery / JavaScript replace xth occurance -


i have string :

var str = "a a";

how replace specific else ?

eg: replace 3rd :

var str = "a 00 a";

of 1st, 2nd, etc.. ?

thanks

i split str, replace whatever index, join back

var str = "a             a";  var sp=str.split('   ');  var ind=2;  sp[ind]='00';  console.log(sp.join('   '));


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -