[#107867] Fwd: [ruby-cvs:91197] 8f59482f5d (master): add some tests for Unicode Version 14.0.0 — Martin J. Dürst <duerst@...>
To everybody taking care of continuous integration:
3 messages
2022/03/13
[#108090] [Ruby master Bug#18666] No rule to make target 'yaml/yaml.h', needed by 'api.o' — duerst <noreply@...>
Issue #18666 has been reported by duerst (Martin D端rst).
7 messages
2022/03/28
[#108117] [Ruby master Feature#18668] Merge `io-nonblock` gems into core — "Eregon (Benoit Daloze)" <noreply@...>
Issue #18668 has been reported by Eregon (Benoit Daloze).
22 messages
2022/03/30
[ruby-core:107955] [Ruby master Bug#18640] default empty string argument for `String#sub` and `String#sub!`, e.g. `"hello".sub("l")`
From:
dorianmariefr <noreply@...>
Date:
2022-03-17 14:46:35 UTC
List:
ruby-core #107955
Issue #18640 has been reported by dorianmariefr (Dorian Mari辿).
----------------------------------------
Bug #18640: default empty string argument for `String#sub` and `String#sub!`, e.g. `"hello".sub("l")`
https://bugs.ruby-lang.org/issues/18640
* Author: dorianmariefr (Dorian Mari辿)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [x86_64-darwin21]
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
Most of the time I replace a string with an empty string. And I think that's the main use case.
Also, `String#delete` deletes every character provided when passed a string.
```ruby
class String
alias original_sub sub
alias original_sub! sub!
def sub(pattern, replacement = "", &block)
original_sub(pattern, replacement, &block)
end
def sub!(pattern, replacement = "", &block)
original_sub!(pattern, replacement, &block)
end
end
puts "hello".sub("l")
puts "hello".sub!("l")
```
What do you think?
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>