るりまサーチ

最速Rubyリファレンスマニュアル検索!
260件ヒット [1-100件を表示] (0.023秒)

別のキーワード

  1. _builtin ==
  2. openssl ==
  3. rexml/document ==
  4. matrix ==
  5. == _builtin

ライブラリ

キーワード

検索結果

<< 1 2 3 > >>

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

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

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

other が文字列でない場合、
other.to_str が定義されていれば
other == self の結果を返します。(ただし、 other.to_str は実行されません。)
そうでなければ false を返します。

@
param...
...
@
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
raise
end

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

@
see String#eql?...

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

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

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

other が文字列でない場合、
other.to_str が定義されていれば
other == self の結果を返します。(ただし、 other.to_str は実行されません。)
そうでなければ false を返します。

@
param...
...
@
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
raise
end

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

@
see String#eql?...

String#+@ -> String | self (6120.0)

self が freeze されている文字列の場合、元の文字列の複製を返します。 freeze されていない場合は self を返します。

...ていない場合は self を返します。

//emlist[例][ruby]{
# frozen_string_literal: false

original_text = "text"
unfrozen_text = +original_text
unfrozen_text.frozen? # => false
original_text == unfrozen_text # => true
original_text.equal?(unfrozen_text) # => true...
...original_text = "text".freeze
unfrozen_text = +original_text
unfrozen_text.frozen? # => false
original_text == unfrozen_text # => true
original_text.equal?(unfrozen_text) # => false
//}

@
see String#-@...

String#-@ -> String | self (6120.0)

self が freeze されている文字列の場合、self を返します。 freeze されていない場合は元の文字列の freeze された (できる限り既存の) 複製を返します。

...できる限り既存の) 複製を返します。

//emlist[例][ruby]{
# frozen_string_literal: false

original_text = "text"
frozen_text = -original_text
frozen_text.frozen? # => true
original_text == frozen_text # => true
original_text.equal?(frozen_text) # => false

ori...
...ginal_text = "text".freeze
frozen_text = -original_text
frozen_text.frozen? # => true
original_text == frozen_text # => true
original_text.equal?(frozen_text) # => true
//}

@
see String#+@...

String#dedup -> String | self (3020.0)

self が freeze されている文字列の場合、self を返します。 freeze されていない場合は元の文字列の freeze された (できる限り既存の) 複製を返します。

...できる限り既存の) 複製を返します。

//emlist[例][ruby]{
# frozen_string_literal: false

original_text = "text"
frozen_text = -original_text
frozen_text.frozen? # => true
original_text == frozen_text # => true
original_text.equal?(frozen_text) # => false

ori...
...ginal_text = "text".freeze
frozen_text = -original_text
frozen_text.frozen? # => true
original_text == frozen_text # => true
original_text.equal?(frozen_text) # => true
//}

@
see String#+@...

絞り込み条件を変える

String#unpack(template) -> Array (116.0)

Array#pack で生成された文字列を テンプレート文字列 template にしたがってアンパックし、 それらの要素を含む配列を返します。

...アンパックし、
それらの要素を含む配列を返します。

@
param template pack テンプレート文字列
@
return オブジェクトの配列


以下にあげるものは、Array#pack、String#unpack
のテンプレート文字の一覧です。テンプレート文...
...されます。
また、`#' から改行あるいはテンプレート文字列の最後まではコメントとみな
され無視されます。

==
= 整数のテンプレート文字のシステム依存性

各テンプレート文字の説明の中で、
short や long はシステムによら...
...rt
l<: little endian int32_t
l!<: little endian signed long
//}

==
= 各テンプレート文字の説明

説明中、Array#pack と String#unpack で違いのあるものは `/' で区切って
「Array#pack の説明 / String#unpack の説明」としています。

: a

ASCII文字列(...
...ックし、
それらの要素を含む配列を返します。

@
param template pack テンプレート文字列
@
return オブジェクトの配列


以下にあげるものは、Array#pack、String#unpack、String#unpack1
のテンプレート文字の一覧です。テンプレ...

String#split(sep = $;, limit = 0) -> [String] (38.0)

第 1 引数 sep で指定されたセパレータによって文字列を limit 個まで分割し、 結果を文字列の配列で返します。 ブロックを指定すると、配列を返す代わりに分割した文字列で ブロックを呼び出します。

...分割する
: limit == 0
分割個数制限はなしで、配列末尾の空文字列を取り除く
: limit < 0
分割個数の制限はなし

@
param sep 文字列を分割するときのセパレータのパターン
@
param limit 分割する最大個数

@
return ブロック...
...//emlist[文字列全体を 1 文字ずつに分割する例][ruby]{
p 'hi there'.split(//).join(':') # => "h:i: :t:h:e:r:e"
//}

//emlist[limit == 0 だと制限なく分割、配列末尾の空文字列は取り除かれる][ruby]{
p "a,b,c,,,".split(/,/, 0) # => ["a", "b", "c"]
//}

//emli...
..."a,b,c,d,e".split(/,/, 6) # => ["a", "b", "c", "d", "e"]
p "a,b,c,d,e".split(/,/, 7) # => ["a", "b", "c", "d", "e"]
//}

//emlist[limit が負の数の場合は制限なく分割][ruby]{
p "a,b,c,,,".split(/,/, -1) # => ["a", "b", "c", "", "", ""]
//}

@
see String#partition, String#rpartition...

String#split(sep = $;, limit = 0) {|s| ... } -> self (38.0)

第 1 引数 sep で指定されたセパレータによって文字列を limit 個まで分割し、 結果を文字列の配列で返します。 ブロックを指定すると、配列を返す代わりに分割した文字列で ブロックを呼び出します。

...分割する
: limit == 0
分割個数制限はなしで、配列末尾の空文字列を取り除く
: limit < 0
分割個数の制限はなし

@
param sep 文字列を分割するときのセパレータのパターン
@
param limit 分割する最大個数

@
return ブロック...
...//emlist[文字列全体を 1 文字ずつに分割する例][ruby]{
p 'hi there'.split(//).join(':') # => "h:i: :t:h:e:r:e"
//}

//emlist[limit == 0 だと制限なく分割、配列末尾の空文字列は取り除かれる][ruby]{
p "a,b,c,,,".split(/,/, 0) # => ["a", "b", "c"]
//}

//emli...
..."a,b,c,d,e".split(/,/, 6) # => ["a", "b", "c", "d", "e"]
p "a,b,c,d,e".split(/,/, 7) # => ["a", "b", "c", "d", "e"]
//}

//emlist[limit が負の数の場合は制限なく分割][ruby]{
p "a,b,c,,,".split(/,/, -1) # => ["a", "b", "c", "", "", ""]
//}

@
see String#partition, String#rpartition...

String#split(sep = $;, limit = 0) -> [String] (32.0)

第 1 引数 sep で指定されたセパレータによって文字列を limit 個まで分割し、 結果を文字列の配列で返します。

...it 個の文字列に分割する
: limit == 0
分割個数制限はなしで、配列末尾の空文字列を取り除く
: limit < 0
分割個数の制限はなし

@
param sep 文字列を分割するときのセパレータのパターン
@
param limit 分割する最大個数...
...//emlist[文字列全体を 1 文字ずつに分割する例][ruby]{
p 'hi there'.split(//).join(':') # => "h:i: :t:h:e:r:e"
//}

//emlist[limit == 0 だと制限なく分割、配列末尾の空文字列は取り除かれる][ruby]{
p "a,b,c,,,".split(/,/, 0) # => ["a", "b", "c"]
//}

//emli...
..."a,b,c,d,e".split(/,/, 6) # => ["a", "b", "c", "d", "e"]
p "a,b,c,d,e".split(/,/, 7) # => ["a", "b", "c", "d", "e"]
//}

//emlist[limit が負の数の場合は制限なく分割][ruby]{
p "a,b,c,,,".split(/,/, -1) # => ["a", "b", "c", "", "", ""]
//}

@
see String#partition, String#rpartition...

String#unicode_normalize!(form = :nfc) -> self (32.0)

self を NFC、NFD、NFKC、NFKD のいずれかの正規化形式で Unicode 正規化し た文字列に置き換えます。

...と異なり)変換が行なわれなくても self を返します。

@
param form 正規化形式を :nfc、:nfd、:nfkc、:nfkd のいずれかで指定しま
す。省略した場合は :nfc になります。

@
raise Encoding::CompatibilityError self が Unicode 文字列ではな...
...に発生します。

//emlist[例][ruby]{
text = "a\u0300"
text.unicode_normalize!(:nfc)
text == "\u00E0" # => true
text.unicode_normalize!(:nfd)
text == "a\u0300" # => true
//}

@
see String#unicode_normalize, String#unicode_normalized?...

絞り込み条件を変える

String#[](nth) -> String | nil (30.0)

nth 番目の文字を返します。 nth が負の場合は文字列の末尾から数えます。 つまり、 self.size + nth 番目の文字を返します。

...

nth が範囲外を指す場合は nil を返します。

@
param nth 文字の位置を表す整数
@
return 指定した位置の文字を表す String オブジェクト

//emlist[例][ruby]{
p 'bar'[2] # => "r"
p 'bar'[2] == ?r # => true
p 'bar'[-1] # => "r"
p 'bar'[3] # =>...

String#[](nth, len) -> String | nil (30.0)

nth 文字目から長さ len 文字の部分文字列を新しく作って返します。 nth が負の場合は文字列の末尾から数えます。

...が負の場合は文字列の末尾から数えます。

@
param nth 取得したい文字列の開始インデックスを整数で指定します。
@
param len 取得したい文字列の長さを正の整数で指定します。

@
return nth が範囲外を指す場合は nil を返しま...
<< 1 2 3 > >>