开发者

how to split into character group? [duplicate]

This question already has answers here: Split large string in n-size chunks in JavaScript (23 answers) Closed 9 years ago.

I want to split string

"abcde开发者_StackOverflow中文版fgh"

to

"ab","cd","ef","gh"

using javascript split()

"abcdefgh".split(???)

Can you please help ?


Instead of split, try match:

var text = "abcdefgh";
print(text.match(/../g));

prints:

ab,cd,ef,gh

as you can see on Ideone.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜