📜  按空格大写字母或下划线分割 javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:52.938000             🧑  作者: Mango

代码示例1
var str = "HelloWorld good_bye";

str = str.split(/[\s_]+|(?=[A-Z])/).join("-");

document.body.innerHTML = str;