











splitTwo 分割2个元素,主要分割文件名和id等
主要解决文件名里面包含 - 的问题 不能直接 split('-')
splitTwo('jfds-fdjskl-jklfds', '-')
splitTwo(str, dash) {
const index = str.indexOf('-')
if (index === -1) {
return [str, '']
}
return [str.slice(0, index), str.slice(index + 1)]
},
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。