Project

General

Profile

Feature #13110

Updated by nobu (Nobuyoshi Nakada) almost 8 years ago

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 #=> "あああいいいおおおあ" 
 ``` 

Back