【发布时间】:2019-07-23 17:30:02
【问题描述】:
我有这个字符串
var str = "394987011016097814 1d the quick brown fox jumped over the lazy dog";
..我正试图让它成为这个数组
[
"394987011016097814",
"1d",
"the quick brown fox jumped over the lazy fox",
]
我已经看到这个答案 Split string on the first white space occurrence 但这只是第一个空格。
【问题讨论】:
-
按要求获得输出不需要任何黑魔法。那么到目前为止,您尝试了什么?为什么这(或对链接问题进行一些细微调整的众多答案之一)不是您要求的答案?
-
您确定要在结果数组的第一个元素末尾添加空格吗?
-
顺便说一句,它是“敏捷的棕色狐狸跳过懒惰的狗”。 ;)
标签: javascript string split