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

Appearance settings

Commit be93a5d

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

File tree

Expand file treeCollapse file tree

1 file changed

+1
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+1
-1
lines changed
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: note/JDK/深入学习String源码与底层(二).md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.