Feature #2645

Updated by naruse (Yui NARUSE) about 7 years ago


In ruby 1.9, StringScanner#pos returns the position in number of bytes. I read on the ruby mailing list ( this happens because working with character-based indexes would be too slow. However, I think it would be nice if StringScanner also provided a method which returned the position in terms of characters (even if it would be slow). As I see it, the situation is the same as with StringScanner#get_byte and StringScanner#getch. I think this would be useful because, when using StringScanner, you're usually interested in the character rather than in bytes.