blob: 954fcf5b44e59940a742a1bdeb0d2888973980f5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
call-seq:
charpos -> character_position
Returns the [character position][7] (initially zero),
which may be different from the [byte position][2]
given by method #pos:
```rb
scanner = StringScanner.new(HIRAGANA_TEXT)
scanner.string # => "こんにちは"
scanner.getch # => "こ" # 3-byte character.
scanner.getch # => "ん" # 3-byte character.
put_situation(scanner)
# Situation:
# pos: 6
# charpos: 2
# rest: "にちは"
# rest_size: 9
```
|