【发布时间】:2018-07-25 14:51:55
【问题描述】:
我想检测一个数组中是否有两个字符串在一个数组中的每一个旁边,然后在其间插入另一个字符串。
因此,如果我的数组包含 ["hello", "there", "hi"] 并且我检查了这个字符串 "hellothere",它会在其间插入字符串 " ",因此它最终会成为 "hello there"。如果我有两个相同的单词相邻,这也应该适用。
我的问题是,我不知道如何检查一个字符串是否包含数组中彼此相邻的两个字符串。
【问题讨论】:
-
订单是否重要,即您是否在寻找“hihello”?
-
无顺序无所谓。
标签: javascript arrays string insert