大家好,我将有一个用连字符分隔的字符串,我想获取字符串的最后一个索引并将其替换为新值
var str1="New-New_Folder"; //Replace New_Folder with Folder so that the str becomes
var newstr1="New-Folder";
var str2="New-New_Folder-New_Folder"; //Replace the last New_Folder with Sub_Folder so that the str becomes
var newstr2="New-New_Folder-Sub_Folder";
有人能帮我一下吗?