why a “” in the 0th index of an array on perfoaming a split() w/o delimiters?

杀马特。学长 韩版系。学妹 提交于 2019-11-28 13:09:00

why am i getting a "" in the 0th index of the str2 array?

Because the delimiter you use has matched here:

 aaaabbddaabbcc
^

Since .split() collects the parts is has "walked by" when it progresses into the string, here it collects the empty string.

Note also that since the delimiter is empty, in order to avoid infinite loops, at the next iteration, .split() will forward one character before starting to search again.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!