i have string looks
atom leu 0.1234 c 0.123 0.32 0.34 how replace c .replace() & in javascript getting location of c? letter of c can anything.
i want
atom leu 0.1234 & 0.123 0.32 0.34.
you can using substring(),
var str = "atom leu 0.1234 c 0.123 0.32 0.34"; var res = str.substring(0, 16) + "&" + str.substring(17); console.log(str); //"atom leu 0.1234 & 0.123 0.32 0.34"
Comments
Post a Comment