小编Jun*_*zed的帖子

JavaScript Split on Any Number of a Character

Is it possible to split on any number of a character in JavaScript, possibly with a regex?

Example:

"These are ____ underscores" will return ["These are ", " underscores"]

Here's what I have so far:

"These are ____ underscores".split("_").filter(x => x);
Run Code Online (Sandbox Code Playgroud)

However, I am not sure if there is a more efficient/better way to do this.

Thanks.

javascript

-2
推荐指数
1
解决办法
52
查看次数

标签 统计

javascript ×1