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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…