[#86787] [Ruby trunk Feature#14723] [WIP] sleepy GC — ko1@...

Issue #14723 has been updated by ko1 (Koichi Sasada).

13 messages 2018/05/01
[#86790] Re: [Ruby trunk Feature#14723] [WIP] sleepy GC — Eric Wong <normalperson@...> 2018/05/01

ko1@atdot.net wrote:

[#87095] [Ruby trunk Feature#14767] [PATCH] gc.c: use monotonic counters for objspace_malloc_increase — ko1@...

Issue #14767 has been updated by ko1 (Koichi Sasada).

9 messages 2018/05/17

[ruby-core:87235] [Ruby trunk Feature#14783] String#chars_at / String#bytes_at

From: mail@...
Date: 2018-05-23 10:23:14 UTC
List: ruby-core #87235
Issue #14783 has been reported by sos4nt (Stefan Schüßler).

----------------------------------------
Feature #14783: String#chars_at / String#bytes_at
https://bugs.ruby-lang.org/issues/14783

* Author: sos4nt (Stefan Schüßler)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
I just wanted to extract characters at certain indices from a string and noticed that there's no `values_at` counterpart for `String`.

I'd therefore like to propose two new `String` methods:

* `chars_at(selector, ...) → new_str`
* `bytes_at(selector, ...) → new_str`

which work basically like [`Array#values_at`](http://ruby-doc.org/core/Array.html#method-i-values_at), e.g.:

```ruby
string = 'hello, world!'
string.chars_at(0, 5, 7, 12)  #=> "h,w!" 
string.chars_at(0..4, 7..11)  #=> "helloworld" 
```





-- 
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>

In This Thread

Prev Next