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

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

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

StringGrid issue in Delphi XE8 firemonkey mobile app -