るりまサーチ

最速Rubyリファレンスマニュアル検索!
110件ヒット [1-100件を表示] (0.061秒)
トップページ > クエリ:String[x] > クエリ:getbyte[x]

別のキーワード

  1. string []=
  2. string slice
  3. string []
  4. string slice!
  5. string gsub!

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

String#getbyte(index) -> Integer | nil (39125.0)

index バイト目のバイトを整数で返します。

...定した場合は nil を返します。

@param index バイトを取り出す位置

//emlist[例][ruby]{
s = "tester"
s.bytes # => [116, 101, 115, 116, 101, 114]
s.getbyte(0) # => 116
s.getbyte(1) # => 101
s.getbyte(-1) # => 114
s.getbyte(6) # => nil
//}...

StringIO#getbyte -> Integer | nil (21119.0)

自身から 1 文字読み込んで、その文字に対応する Fixnum を返します。 文字列の終端に到達した時には nil を返します。

...字列の終端に到達した時には nil を返します。

@raise IOError 自身が読み取り不可なら発生します。

//emlist[例][ruby]{
require "stringio"
a = StringIO.new("ho")
a.getbyte #=> 104
a.getbyte #=> 111
a.getbyte #=> nil
//}...

StringScanner#getbyte -> String | nil (18209.0)

1 バイトスキャンして文字列で返します。 スキャンポインタをその後ろに進めます。 スキャンポインタが文字列の末尾を指すなら nil を返します。

...指すなら nil を返します。

String
Scanner#getbyte は将来のバージョンで削除される予定です。
代わりに StringScanner#get_byte を使ってください。

//emlist[例][ruby]{
require 'strscan'

utf8 = "\u{308B 3073 3044}"
s = StringScanner.new(utf8.encode("EUC-JP"))
p...

StringIO#ungetbyte(char) -> nil (9100.0)

指定された char を読み戻します。

...指定された char を読み戻します。

2バイト以上の読み戻しは保証されません。

@param char 読み戻したい1文字かそのコードポイントを指定します。

@see IO#ungetbyte...

StringScanner#get_byte -> String | nil (3109.0)

1 バイトスキャンして文字列で返します。 スキャンポインタをその後ろに進めます。 スキャンポインタが文字列の末尾を指すなら nil を返します。

...指すなら nil を返します。

String
Scanner#getbyte は将来のバージョンで削除される予定です。
代わりに StringScanner#get_byte を使ってください。

//emlist[例][ruby]{
require 'strscan'

utf8 = "\u{308B 3073 3044}"
s = StringScanner.new(utf8.encode("EUC-JP"))
p...

絞り込み条件を変える

ARGF.class#gets(limit) -> String | nil (109.0)

ARGFの現在位置から一行ずつ文字列として読み込みます。EOF に到達した時に は nil を返します。

...est.txt

# test.rb
ARGF.gets("e") # => "line"


例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets("") # => "line1\nline2\nline3\n\n"

@see Kernel.#gets, IO#gets, ARGF.class#getbyte, ARGF.class#getc...

ARGF.class#gets(limit, chomp: false) -> String | nil (109.0)

ARGFの現在位置から一行ずつ文字列として読み込みます。EOF に到達した時に は nil を返します。

...est.txt

# test.rb
ARGF.gets("e") # => "line"


例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets("") # => "line1\nline2\nline3\n\n"

@see Kernel.#gets, IO#gets, ARGF.class#getbyte, ARGF.class#getc...

ARGF.class#gets(rs = $/) -> String | nil (109.0)

ARGFの現在位置から一行ずつ文字列として読み込みます。EOF に到達した時に は nil を返します。

...est.txt

# test.rb
ARGF.gets("e") # => "line"


例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets("") # => "line1\nline2\nline3\n\n"

@see Kernel.#gets, IO#gets, ARGF.class#getbyte, ARGF.class#getc...

ARGF.class#gets(rs = $/, chomp: false) -> String | nil (109.0)

ARGFの現在位置から一行ずつ文字列として読み込みます。EOF に到達した時に は nil を返します。

...est.txt

# test.rb
ARGF.gets("e") # => "line"


例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets("") # => "line1\nline2\nline3\n\n"

@see Kernel.#gets, IO#gets, ARGF.class#getbyte, ARGF.class#getc...

ARGF.class#gets(rs, limit) -> String | nil (109.0)

ARGFの現在位置から一行ずつ文字列として読み込みます。EOF に到達した時に は nil を返します。

...est.txt

# test.rb
ARGF.gets("e") # => "line"


例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets("") # => "line1\nline2\nline3\n\n"

@see Kernel.#gets, IO#gets, ARGF.class#getbyte, ARGF.class#getc...

絞り込み条件を変える

ARGF.class#gets(rs, limit, chomp: false) -> String | nil (109.0)

ARGFの現在位置から一行ずつ文字列として読み込みます。EOF に到達した時に は nil を返します。

...est.txt

# test.rb
ARGF.gets("e") # => "line"


例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets("") # => "line1\nline2\nline3\n\n"

@see Kernel.#gets, IO#gets, ARGF.class#getbyte, ARGF.class#getc...

ARGF.class#getc -> String | nil (107.0)

self から 1 文字読み込んで返します。EOF に到達した時には nil を返します。

...foo" > file1
$ echo "bar" > file2
$ ruby argf.rb file1 file2

ARGF.getc # => "f"
ARGF.getc # => "o"
ARGF.getc # => "o"
ARGF.getc # => "\n"
ARGF.getc # => "b"
ARGF.getc # => "a"
ARGF.getc # => "r"
ARGF.getc # => "\n"
ARGF.getc # => nil

@see ARGF.class#getbyte, ARGF.class#gets...

ruby 1.8.2 feature (96.0)

ruby 1.8.2 feature ruby 1.8.2 での ruby 1.8.1 からの変更点です。

...((<ruby-core:03922>))

: String#inspect [ruby] [bug]
式展開になる '#'がエスケープされるようになりました。
((<ruby-core:03922>))
$ ruby1.8.1 -e "puts '# #{}'.inspect"
"# #{}"

$ ruby1.8.2 -e "puts '# #{}'.inspect"
"# \#{}"

: String#dump [ruby] [bug]
...
...conv [lib] [new]
: Kconv.guess_old(str)
: Kconv.toutf8(str)
: Kconv.toutf16(str)
: String#toutf8,
: String#toutf16
: String#iseuc
: String#issjis
: String#isutf8

=== 2004-11-18
: StringIO.new [lib] [compat]
String
IO.newの第二引数にIO.newと同様、Fixnum も指定できるようになり...
....
: StringScanner#empty? [lib] [obsolete]
$VERVOSE が設定されている時に警告がでるようになりました。use #eos?.
: StringScanner#clear [lib] [obsolete]
$VERVOSE が設定されている時に警告がでるようになりました。use #terminate.
: StringScanner#getbyte [...
<< 1 2 > >>