Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions doc/stringio/getbyte.rdoc
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,16 +14,18 @@ Returns +nil+ if at end-of-stream:

Returns a byte, not a character:

s = 'тест'
s.bytes # => [209, 130, 208, 181, 209, 129, 209, 130]
s = 'Привет'
s.bytes
# => [208, 159, 209, 128, 208, 184, 208, 178, 208, 181, 209, 130]
strio = StringIO.new(s)
strio.getbyte # => 209
strio.getbyte # => 130
strio.getbyte # => 208
strio.getbyte # => 159

s = 'こんにちは'
s.bytes # => [227, 129, 147, 227, 130, 147, 227, 129, 171, 227, 129, 161, 227, 129, 175]
s.bytes
# => [227, 129, 147, 227, 130, 147, 227, 129, 171, 227, 129, 161, 227, 129, 175]
strio = StringIO.new(s)
strio.getbyte # => 227
strio.getbyte # => 129

Related: StringIO.getc.
Related: #each_byte, #ungetbyte, #getc.
Loading