Commit be43fe24
be43fe24ab15Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 3 files · +2 added · ~1 modified
Description
Merge pull request #1089 from neidiom/fix/str-split-space-special
Fix String#split(" ") to use whitespace-split mode
Details
- Commit
- be43fe24ab15
- Parent
- 8b11039f303d
- Merge parent
- 5642b5c9c630
spinel_codegen.rbmodifiedView file
@@ -21140,6 +21140,11 @@
2114021140
if @nd_type[a[0]] == "NilNode"2114121141
return "sp_str_split_ws(" + rc + ")"2114221142
end21143+
# CRuby special case: split(" ") is whitespace-split mode (strips21144+
# leading whitespace, collapses consecutive), not literal " " split.21145+
if @nd_type[a[0]] == "StringNode" && @nd_content[a[0]] == " "21146+
return "sp_str_split_ws(" + rc + ")"21147+
end2114321148
# Two-arg split(sep, limit) -- positive limit caps the result at2114421149
# that many elements with the last one holding the unsplit2114521150
# remainder. Issue #619 puzzle 2.test/str_split_space_whitespace.rbaddedView file
Loading diff…
test/str_split_space_whitespace.rb.expectedaddedView file
Loading diff…