Project

General

Profile

Actions

Feature #13110

open

Byte-based operations for String

Added by shugo (Shugo Maeda) over 4 years ago. Updated over 4 years ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:78998]

Description

How about to add byte-based operations for String?

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) byteindex.diff PoC code for String#byteindex and Regexp#byteoffset shugo (Shugo Maeda), 01/06/2017 04:03 PM
Actions

Also available in: Atom PDF