[#90865] [Ruby trunk Bug#15499] Breaking behavior on ruby 2.6: rb_thread_call_without_gvl doesn't invoke unblock_function when used on the main thread — apolcyn@...
Issue #15499 has been reported by apolcyn (alex polcyn).
3 messages
2019/01/03
[#90877] [Ruby trunk Bug#15499] Breaking behavior on ruby 2.6: rb_thread_call_without_gvl doesn't invoke unblock_function when used on the main thread — apolcyn@...
Issue #15499 has been updated by apolcyn (alex polcyn).
3 messages
2019/01/03
[#90895] Re: [ruby-alerts:11680] failure alert on trunk-mjit@silicon-docker (NG (r66707)) — Eric Wong <normalperson@...>
ko1c-failure@atdot.net wrote:
4 messages
2019/01/05
[#90896] Re: [ruby-alerts:11680] failure alert on trunk-mjit@silicon-docker (NG (r66707))
— Takashi Kokubun <takashikkbn@...>
2019/01/05
Thanks to explain that.
[#91200] [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout — glass.saga@...
Issue #15553 has been reported by Glass_saga (Masaki Matsushita).
4 messages
2019/01/21
[#91289] Re: [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout
— Eric Wong <normalperson@...>
2019/01/26
glass.saga@gmail.com wrote:
[ruby-core:90884] [Ruby trunk Feature#15496] Extract between string as standard String api
From:
duerst@...
Date:
2019-01-04 06:46:44 UTC
List:
ruby-core #90884
Issue #15496 has been updated by duerst (Martin D端rst).
macdevign (Macdevign mac) wrote:
> Given that string "between" extraction is such a common operation,
Can you back that up with some additional information/data? For example, do you know other programming languages that have such a function/method?
I haven't had the need for such a method, and use cases I can think of very quickly need additional or different parameters (such as xth occurrence, between (Regexp) patterns rather than simple strings, before or after a string,...), which suggests to me that solving this specific problem with the general regular expression functionality already in Ruby.
----------------------------------------
Feature #15496: Extract between string as standard String api
https://bugs.ruby-lang.org/issues/15496#change-76071
* Author: macdevign (Macdevign mac)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
I could not find the a simple String api to extract the string between two string, and I notice that many face the same issue and endup rolling their own solutions (eg https://stackoverflow.com/questions/9661478/how-to-return-the-substring-of-a-string-between-two-strings-in-ruby).
Given that string "between" extraction is such a common operation, will adding a focused and simplified String method make coding pleasant ?
This is my solution but probably someone can provide better and efficient implementation.
~~~
# self: String instance,
# from: first 'from' String
# to: first 'to' String found after 'from'
# return string between from and to, which exclude the argument, nil otherwise.
def between(from, to)
from_idx = self.index(from)&.+(from.length)
if from_idx
to_idx = self.index(to, from_idx)
return self[from_idx...to_idx] if to_idx
end
nil
end
~~~
Test case
"Hello world".between("ell", "ld") => "o wor"
"Testing 123".between("Te", "123") => "sting "
--
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>