Project

General

Profile

Actions

Feature #2645

closed

Have a method in StringScanner which returns the position in characters rather than in bytes

Added by stefanocr (Stefano Crocco) almost 15 years ago. Updated about 12 years ago.

Status:
Rejected
Target version:
[ruby-core:27792]

Description

=begin
In ruby 1.9, StringScanner#pos returns the position in number of bytes. I read on the ruby mailing list (http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/352809) 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.
=end


Related issues 1 (0 open1 closed)

Is duplicate of Ruby master - Feature #1159: StringScanner に文字ベースでのインデックスを返すメソッドがほしいRejectedaamine (Minero Aoki)02/14/2009Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0