クラス
-
CSV
:: Table (36) - MatchData (12)
-
Net
:: HTTPGenericRequest (12) -
Net
:: HTTPResponse (24) - String (54)
- StringScanner (24)
モジュール
-
Net
:: HTTPHeader (96)
キーワード
- [] (48)
-
basic
_ auth (12) - body (12)
- byteindex (3)
- byterindex (3)
- delete (12)
- fetch (36)
-
get
_ fields (12) - getbyte (12)
- pointer= (12)
- pos= (12)
-
proxy
_ basic _ auth (12) -
read
_ body (24) - rindex (12)
- setbyte (12)
-
values
_ at (12)
検索結果
先頭5件
-
String
# index(pattern , pos = 0) -> Integer | nil (48192.0) -
文字列のインデックス pos から右に向かって pattern を検索し、 最初に見つかった部分文字列の左端のインデックスを返します。 見つからなければ nil を返します。
...探索します。
@param pattern 探索する部分文字列または正規表現
@param pos 探索を開始するインデックス
//emlist[例][ruby]{
p "astrochemistry".index("str") # => 1
p "regexpindex".index(/e.*x/, 2) # => 3
p "character".index(?c)......# => 0
p "foobarfoobar".index("bar", 6) # => 9
p "foobarfoobar".index("bar", -6) # => 9
//}
@see String#rindex......# => 0
p "foobarfoobar".index("bar", 6) # => 9
p "foobarfoobar".index("bar", -6) # => 9
//}
@see String#rindex
@see String#byteindex... -
String
# rindex(pattern , pos = self . size) -> Integer | nil (36227.0) -
文字列のインデックス pos から左に向かって pattern を探索します。 最初に見つかった部分文字列の左端のインデックスを返します。 見つからなければ nil を返します。
...列または正規表現で指定します。
pos が負の場合は、文字列の末尾から数えた位置から探索します。
rindex と String#index とでは、探索方向だけが逆になります。
完全に左右が反転した動作をするわけではありません。
探索......//emlist[String#index の場合][ruby]{
p "stringstring".index("ing", 1) # => 3
# ing # ここから探索を始める
# ing
# ing # 右にずらしていってここで見つかる
//}
//emlist[String#rindex の場合][ruby]{
p "stringstring".rindex("ing", -1) #......で見つかる
//}
@param pattern 探索する部分文字列または正規表現
@param pos 探索を始めるインデックス
//emlist[例][ruby]{
p "astrochemistry".rindex("str") # => 10
p "character".rindex(?c) # => 5
p "regexprindex".rindex(/e.*x/, 2) #... -
String
# byterindex(pattern , offset = self . bytesize) -> Integer | nil (36215.0) -
文字列のバイト単位のインデックス offset から左に向かって pattern を探索します。 最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。 見つからなければ nil を返します。
...は正規表現で指定します。
offset が負の場合は、文字列の末尾から数えた位置から探索します。
byterindex と String#byteindex とでは、探索方向だけが逆になります。
完全に左右が反転した動作をするわけではありません。
探索......list[String#byteindex の場合][ruby]{
p "stringstring".byteindex("ing", 1) # => 3
# ing # ここから探索を始める
# ing
# ing # 右にずらしていってここで見つかる
//}
//emlist[String#byterindex の場合][ruby]{
p "stringstring".byterindex("ing......見つかる
//}
@param pattern 探索する部分文字列または正規表現
@param offset 探索を始めるバイト単位のインデックス
//emlist[例][ruby]{
'foo'.byterindex('f') # => 0
'foo'.byterindex('o') # => 2
'foo'.byterindex('oo') # => 1
'foo'.byterindex('ooo') # => nil... -
String
# byteindex(pattern , offset = 0) -> Integer | nil (36167.0) -
文字列の offset から右に向かって pattern を検索し、 最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。 見つからなければ nil を返します。
...す。
@param pattern 探索する部分文字列または正規表現
@param offset 探索を開始するバイト単位のオフセット
@raise IndexError オフセットが文字列の境界以外をさしているときに発生します。
//emlist[例][ruby]{
'foo'.byteindex('f') #......0
'foo'.byteindex('o') # => 1
'foo'.byteindex('oo') # => 1
'foo'.byteindex('ooo') # => nil
'foo'.byteindex(/f/) # => 0
'foo'.byteindex(/o/) # => 1
'foo'.byteindex(/oo/) # => 1
'foo'.byteindex(/ooo/) # => nil
'foo'.byteindex('o', 1) # => 1
'foo'.byteindex('o', 2) # => 2
'foo'.byteindex('o', 3) # =......> nil
'foo'.byteindex('o', -1) # => 2
'foo'.byteindex('o', -2) # => 1
'foo'.byteindex('o', -3) # => 1
'foo'.byteindex('o', -4) # => nil
'あいう'.byteindex('う') # => 6
'あいう'.byteindex('う', 3) # => 6
'あいう'.byteindex('う', -3) # => 6
'あいう'.byteindex('う', 1) # offset 1 does... -
String
# setbyte(index , b) -> Integer (30160.0) -
index バイト目のバイトを b に変更します。
...
index バイト目のバイトを b に変更します。
index に負を指定すると末尾から数えた位置を変更します。
セットした値を返します。
@param index バイトをセットする位置
@param b セットするバイト(0 から 255 までの整数)
@raise Inde......xError 範囲外に値をセットしようとした場合に発生します。
//emlist[例][ruby]{
s = "Sunday"
s.setbyte(0, 77)
s.setbyte(-5, 111)
s # => "Monday"
//}... -
String
# getbyte(index) -> Integer | nil (30148.0) -
index バイト目のバイトを整数で返します。
...
index バイト目のバイトを整数で返します。
index に負を指定すると末尾から数えた位置のバイト
を取り出します。
範囲外を指定した場合は nil を返します。
@param index バイトを取り出す位置
//emlist[例][ruby]{
s = "tester"
s.bytes... -
StringScanner
# pointer=(n) (6049.0) -
スキャンポインタのインデックスを n にセットします。
...トします。
@param n 整数で、バイト単位で指定します。
負数を指定すると文字列の末尾からのオフセットとして扱います。
@raise RangeError マッチ対象の文字列の長さを超える値を指定すると発生します。
@return n を返......す。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
p s.scan(/\w+/) # => "test"
p s.pos = 1 # => 1
p s.scan(/\w+/) # => "est"
p s.pos = 7 # => 7
p s.scan(/\w+/) # => "ring"
begin
s.pos = 20
rescue RangeError => err
puts err #=> index out of range
end
p s... -
StringScanner
# pos=(n) (6049.0) -
スキャンポインタのインデックスを n にセットします。
...トします。
@param n 整数で、バイト単位で指定します。
負数を指定すると文字列の末尾からのオフセットとして扱います。
@raise RangeError マッチ対象の文字列の長さを超える値を指定すると発生します。
@return n を返......す。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
p s.scan(/\w+/) # => "test"
p s.pos = 1 # => 1
p s.scan(/\w+/) # => "est"
p s.pos = 7 # => 7
p s.scan(/\w+/) # => "ring"
begin
s.pos = 20
rescue RangeError => err
puts err #=> index out of range
end
p s... -
CSV
:: Table # [](index) -> CSV :: Row | [String] | nil (342.0) -
ミックスモードでは、このメソッドは引数に行番号を指定すれば行単位で動作 し、ヘッダの名前を指定すれば列単位で動作します。
...
@param index ミックスモード・ロウモードでは、取得したい行の行番号を整数で指定します。
カラムモードでは、取得したい列の列番号を整数で指定します。
@param range 取得したい範囲を整数の範囲で指定します。
@......param header 取得したい列のヘッダを文字列で指定します。ロウモードでは使用できません。
//emlist[例][ruby]{
require "csv"
row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
table = C... -
MatchData
# values _ at(*index) -> [String] (334.0) -
正規表現中の n 番目の括弧にマッチした部分文字列の配列を返します。
...番目は $& のようにマッチした文字列全体を表します。
@param index インデックスを整数またはシンボル(名前付きキャプチャの場合)で 0 個以上指定します。
//emlist[例][ruby]{
m = /(foo)(bar)(baz)/.match("foobarbaz")
# same as m.to_a.values_at(........z", "foo", "bar", "baz", nil]
p m.values_at(-1, -2, -3, -4, -5) # => ["baz", "bar", "foo", nil, nil]
m = /(?<a>\d+) *(?<op>[+\-*\/]) *(?<b>\d+)/.match("1 + 2")
m.to_a # => ["1 + 2", "1", "+", "2"]
m.values_at(:a, :b, :op) # => ["1", "2", "+"]
//}
@see Array#values_at, Array#[]...