Performance question: String.split and then walk on the array, or RegExp?

前端 未结 3 742
隐瞒了意图╮
隐瞒了意图╮ 2021-01-01 19:47

I\'ll do some work on a line separated string. Which one will be faster, to split the text via String.split first and then walk on the resultant array or directly walk the w

3条回答
  •  遥遥无期
    2021-01-01 20:18

    I expect that using split() will be much faster. It depends upon many specifics, number of lines vs. length, complexity of regex, etc.

提交回复
热议问题