るりまサーチ

最速Rubyリファレンスマニュアル検索!
1477件ヒット [1301-1400件を表示] (0.112秒)
トップページ > クエリ:Ruby[x] > 種類:インスタンスメソッド[x] > クエリ:r[x] > クエリ:ruby[x] > クエリ:self[x] > クラス:String[x]

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

キーワード

検索結果

<< < ... 12 13 14 15 > >>

String#==(other) -> bool (3120.0)

other が文字列の場合、String#eql? と同様に文字列の内容を比較します。

...other が文字列の場合、String#eql? と同様に文字列の内容を比較します。

other が文字列でない場合、
other.to_str が定義されていれば
other == self の結果を返します。(ただし、 other.to_str は実行されません。)
そうでなければ false...
...ram other 任意のオブジェクト
@return true か false

//emlist[例][ruby]{
string
like = Object.new

def stringlike.==(other)
"string" == other
end

p "string".eql?(stringlike) #=> false
p "string" == stringlike #=> false

def stringlike.to_str
r
aise
end

p "string".eql?(str...
...inglike) #=> false
p "string" == stringlike #=> true
//}

@see String#eql?...

String#===(other) -> bool (3120.0)

other が文字列の場合、String#eql? と同様に文字列の内容を比較します。

...other が文字列の場合、String#eql? と同様に文字列の内容を比較します。

other が文字列でない場合、
other.to_str が定義されていれば
other == self の結果を返します。(ただし、 other.to_str は実行されません。)
そうでなければ false...
...ram other 任意のオブジェクト
@return true か false

//emlist[例][ruby]{
string
like = Object.new

def stringlike.==(other)
"string" == other
end

p "string".eql?(stringlike) #=> false
p "string" == stringlike #=> false

def stringlike.to_str
r
aise
end

p "string".eql?(str...
...inglike) #=> false
p "string" == stringlike #=> true
//}

@see String#eql?...

String#=~(other) -> Integer | nil (3120.0)

正規表現 other とのマッチを行います。 マッチが成功すればマッチした位置のインデックスを、そうでなければ nil を返します。

...正規表現 other とのマッチを行います。
マッチが成功すればマッチした位置のインデックスを、そうでなければ nil を返します。

other が正規表現でも文字列でもない場合は
other =~ self を行います。

このメソッドが実行され...
...する情報が設定されます。

@param other 正規表現もしくは =~ メソッドを持つオブジェクト
@raise TypeError other が文字列の場合に発生します。

//emlist[例][ruby]{
p "string" =~ /str/ # => 0
p "string" =~ /not/ # => nil
p "abcfoo" =~ /foo/ #...

String#hex -> Integer (3120.0)

文字列に 16 進数で数値が表現されていると解釈して整数に変換します。 接頭辞 "0x", "0X" とアンダースコアは無視されます。 文字列が [_0-9a-fA-F] 以外の文字を含むときはその文字以降を無視します。

...

self
が空文字列のときは 0 を返します。

//emlist[例][ruby]{
p "10".hex # => 16
p "ff".hex # => 255
p "0x10".hex # => 16
p "-0x10".hex # => -16

p "xyz".hex # => 0
p "10z".hex # => 16
p "1_0".hex # => 16

p "".hex # => 0
//}

@see String#oct, String#to_i, String#to...
..._f,
Kernel.#Integer, Kernel.#Float

このメソッドの逆に数値を文字列に変換するには
Kernel.#sprintf, String#%,
Integer#to_s
などを使ってください。...

String#sub!(pattern, hash) -> String (3119.0)

文字列中の pattern にマッチした部分をキーにして hash を引いた値で破壊的に置き換えます。

...字列中の pattern にマッチした部分をキーにして hash を引いた値で破壊的に置き換えます。

@param pattern 置き換える文字列のパターン
@param hash 置き換える文字列を与えるハッシュ
@return 置換した場合は self、置換しなか...

絞り込み条件を変える

String#[]=(range, val) (3115.0)

rangeで指定したインデックスの範囲に含まれる部分文字列を文字列 val で置き換えます。

...
r
angeで指定したインデックスの範囲に含まれる部分文字列を文字列 val で置き換えます。

@param range 置き換えたい範囲を示す Range オブジェクト

@return val を返します。...

String#each_byte -> Enumerator (3115.0)

文字列の各バイトに対して繰り返します。

...文字列の各バイトに対して繰り返します。

//emlist[例][ruby]{
"str".each_byte do |byte|
p byte
end
# => 115
# => 116
# => 114

"あ".each_byte do |byte|
p byte
end
# => 227
# => 129
# => 130
//}

@see String#bytes...

String#each_byte {|byte| ... } -> self (3115.0)

文字列の各バイトに対して繰り返します。

...文字列の各バイトに対して繰り返します。

//emlist[例][ruby]{
"str".each_byte do |byte|
p byte
end
# => 115
# => 116
# => 114

"あ".each_byte do |byte|
p byte
end
# => 227
# => 129
# => 130
//}

@see String#bytes...

String#each_codepoint -> Enumerator (3115.0)

文字列の各コードポイントに対して繰り返します。

...ます。

//emlist[例][ruby]{
#coding:UTF-8
"hello わーるど".each_codepoint.to_a
# => [104, 101, 108, 108, 111, 32, 12431, 12540, 12427, 12393]
"hello わーるど".encode('euc-jp').each_codepoint.to_a
# => [104, 101, 108, 108, 111, 32, 42223, 41404, 42219, 42185]
//}

@see String#codepoints...
<< < ... 12 13 14 15 > >>