From: "austin (Austin Ziegler)" Date: 2022-02-17T15:22:31+00:00 Subject: [ruby-core:107639] [Ruby master Feature#13110] Byte-based operations for String Issue #13110 has been updated by austin (Austin Ziegler). matz (Yukihiro Matsumoto) wrote in #note-24: > Regarding names, I accept `byteindex`, `byterindex`, `byteoffset`. > I am against `byte_rindex` since I consider the naming consistency is more important. This could be opened as a new issue, but would it be possible to consider adding more readable aliases as suggested by Shugo in #note-22 with the idea that for Ruby 4.0, the non-underscored versions would be removed? That is, add `byte_slice`, `get_byte`, `set_byte`, etc. in 3.2; mark `byteslice` &c. as deprecated in 3.4, and eventually remove `byteslice` &c. in 4.0? ---------------------------------------- Feature #13110: Byte-based operations for String https://bugs.ruby-lang.org/issues/13110#change-96551 * Author: shugo (Shugo Maeda) * Status: Assigned * Priority: Normal * Assignee: matz (Yukihiro Matsumoto) ---------------------------------------- How about to add byte-based operations for String? ```ruby s = "���������������������������" p s.byteindex(/������/, 4) #=> 18 x, y = Regexp.last_match.byteoffset(0) #=> [18, 24] s.bytesplice(x...y, "���������") p s #=> "������������������������������" ``` ---Files-------------------------------- byteindex.diff (2.83 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: