JavaScript字串取代

 只取代一次

var str=  namestr.replace('u', '\\u')


字串內所有相同得都取代掉

var str=  namestr.replace(/u/g, '\\u')

留言

此網誌的熱門文章