Skip to content

Commit ec546c8

Browse files
committed
Improve position example
1 parent 91c28a7 commit ec546c8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ext/stringio/stringio.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -957,11 +957,11 @@ strio_get_sync(VALUE self)
957957
* The position in the stream matters:
958958
*
959959
* bytes = []
960-
* strio = StringIO.new('hello')
961-
* strio.getc # => "h"
962-
* strio.pos # => 1
960+
* strio = StringIO.new('こんにちは')
961+
* strio.getc # => ""
962+
* strio.pos # => 3 # 3-byte character was read.
963963
* strio.each_byte {|byte| bytes.push(byte) }
964-
* bytes # => [101, 108, 108, 111]
964+
* bytes # => [227, 130, 147, 227, 129, 171, 227, 129, 161, 227, 129, 175]
965965
*
966966
* If at end-of-file, does not call the block:
967967
*

0 commit comments

Comments
 (0)