7件ヒット
[1-7件を表示]
(0.201秒)
ライブラリ
- ビルトイン (7)
キーワード
- == (1)
- === (1)
-
end
_ with? (1) - eql? (1)
- include? (1)
-
start
_ with? (1) -
unicode
_ normalized? (1)
検索結果
先頭5件
-
String
# end _ with?(*strs) -> bool (18946.0) -
self の末尾が strs のいずれかであるとき true を返します。
...ずれかであるとき true を返します。
@param strs パターンを表す文字列 (のリスト)
//emlist[例][ruby]{
"string".end_with?("ing") # => true
"string".end_with?("str") # => false
"string".end_with?("str", "ing") # => true
//}
@see String#start_with?... -
String
# start _ with?(*strs) -> bool (18946.0) -
self の先頭が strs のいずれかであるとき true を返します。
...れかであるとき true を返します。
@param strs パターンを表す文字列 (のリスト)
//emlist[例][ruby]{
"string".start_with?("str") # => true
"string".start_with?("ing") # => false
"string".start_with?("ing", "str") # => true
//}
@see String#end_with?... -
String
# ==(other) -> bool (9967.0) -
other が文字列の場合、String#eql? と同様に文字列の内容を比較します。
...other が文字列の場合、String#eql? と同様に文字列の内容を比較します。
other が文字列でない場合、
other.to_str が定義されていれば
other == self の結果を返します。(ただし、 other.to_str は実行されません。)
そうでなければ false......st[例][ruby]{
stringlike = 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" == stringlike #=> true
//}
@see String#eql?... -
String
# ===(other) -> bool (9967.0) -
other が文字列の場合、String#eql? と同様に文字列の内容を比較します。
...other が文字列の場合、String#eql? と同様に文字列の内容を比較します。
other が文字列でない場合、
other.to_str が定義されていれば
other == self の結果を返します。(ただし、 other.to_str は実行されません。)
そうでなければ false......st[例][ruby]{
stringlike = 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" == stringlike #=> true
//}
@see String#eql?... -
String
# eql?(other) -> bool (9964.0) -
文字列の内容が文字列 other の内容と等しいときに true を返します。 等しくなければ false を返します。
...します。
同一のオブジェクトかどうかを比較するわけではありません。
つまり、"string".eql?(str) という式を実行した場合には、
str が "string" という内容の文字列でありさえすれば常に true を返します。
同一のオブジェクト......、String#upcase,
String#downcase で大文字小文字を揃えてから比較してください。
Hash クラス内での比較に使われます。
@param other 任意のオブジェクト
@return true か false
//emlist[例][ruby]{
p "string".eql?("string") # => true
p "string".e......ql?("STRING") # => false
p "string".eql?("") # => false
p "".eql?("string") # => false
p "string".eql?("str" + "ing") # => true (内容が同じなら true)
p "string".eql?("stringX".chop) # => true (内容が同じなら true)
p "string".upcase.eql?("String".upcase) # =>... -
String
# include?(substr) -> bool (9928.0) -
文字列中に部分文字列 substr が含まれていれば真を返します。
文字列中に部分文字列 substr が含まれていれば真を返します。
@param substr 検索する文字列
//emlist[例][ruby]{
"hello".include? "lo" #=> true
"hello".include? "ol" #=> false
"hello".include? ?h #=> true
//} -
String
# unicode _ normalized?(form = :nfc) -> bool (9700.0) -
self が引数 form で指定された正規化形式で Unicode 正規化された文字列か どうかを返します。
...=> true
"\u00E0".unicode_normalized? # => true
"\u00E0".unicode_normalized?(:nfd) # => false
"\xE0".force_encoding('ISO-8859-1').unicode_normalized?
# => Encoding::CompatibilityError raised
//}
@see String#unicode_normalize, String#unicode_normalize!...