Class: StringScanner
Instance Method Summary collapse
Instance Method Details
#charpos ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/sql_lexer/string_scanner.rb', line 3 def charpos if string.respond_to?(:byteslice) string.byteslice(0, pos).length else string.unpack("@0a#{pos}").first.force_encoding("UTF-8").length end end |