Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit be93a5d

Browse files
[U] 修改String源码分析中,split()方法中传入limit > 0时的错误逻辑
1 parent a8d3133 commit be93a5d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎note/JDK/深入学习String源码与底层(二).md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ list集合里就会添加进空字符串""
497497
```
498498

499499
对于入参limit,可以总结一下为:
500-
1. limit > 0,split()方法不进行拆分,最多把字符串拆分成limit个部分
500+
1. limit > 0,split()方法最多把字符串拆分成limit个部分
501501
2. limit = 0,split()方法会拆分匹配到的最后一位regex。
502502
3. limit < 0,split()方法会根据regex匹配到的最后一位,如果最后一位为regex,则多添加一位空字符串;如果不是则添加regex到字符串末尾的子字符串。
503503

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /