154件ヒット
[1-100件を表示]
(0.127秒)
ライブラリ
- ビルトイン (110)
- fiddle (22)
- ipaddr (11)
-
rexml
/ document (11)
クラス
- Array (33)
-
Fiddle
:: Pointer (22) - IPAddr (11)
- Object (22)
-
REXML
:: Attribute (11) - String (55)
検索結果
先頭5件
-
String
# to _ str -> String (36210.0) -
self を返します。
...self を返します。
//emlist[例][ruby]{
p "str".to_s # => "str"
p "str".to_str # => "str"
//}
このメソッドは、文字列を他のクラスのインスタンスと混ぜて処理したいときに有効です。
例えば返り値が文字列か nil であるメソッド some_met... -
String
# to _ s -> String (21110.0) -
self を返します。
...self を返します。
//emlist[例][ruby]{
p "str".to_s # => "str"
p "str".to_str # => "str"
//}
このメソッドは、文字列を他のクラスのインスタンスと混ぜて処理したいときに有効です。
例えば返り値が文字列か nil であるメソッド some_met... -
String
# ==(other) -> bool (21071.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 (21071.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) -> -1 | 0 | 1 | nil (21031.0) -
self と other を ASCII コード順で比較して、 self が大きい時には 1、等しい時には 0、小さい時には -1 を返します。 このメソッドは Comparable モジュールのメソッドを実装するために使われます。
...のメソッドは Comparable モジュールのメソッドを実装するために使われます。
other が文字列でない場合、
other.to_str と other.<=> が定義されていれば
0 - (other <=> self) の結果を返します。
そうでなければ nil を返します。
@param ot......her 文字列
@return 比較結果の整数か nil
//emlist[例][ruby]{
p "aaa" <=> "xxx" # => -1
p "aaa" <=> "aaa" # => 0
p "xxx" <=> "aaa" # => 1
p "string" <=> "stringAA" # => -1
p "string" <=> "string" # => 0
p "stringAA" <=> "string" # => 1
//}... -
Object
# to _ str -> String (18231.0) -
オブジェクトの String への暗黙の変換が必要なときに内部で呼ばれます。 デフォルトでは定義されていません。
...オブジェクトの String への暗黙の変換が必要なときに内部で呼ばれます。
デフォルトでは定義されていません。
説明のためここに記載してありますが、
このメソッドは実際には Object クラスには定義されていません。
必......面で代置可能であるような、
* 文字列そのものとみなせるようなもの
という厳しいものになっています。
//emlist[][ruby]{
class Foo
def to_str
'Edition'
end
end
it = Foo.new
p('Second' + it) #=> "SecondEdition"
//}
@see Object#to_s,Kernel.#String... -
Fiddle
:: Pointer # to _ str -> String (18205.0) -
自身が指す領域から長さ len の文字列を複製して返します。
自身が指す領域から長さ len の文字列を複製して返します。
len を省略した場合は、self.size をその代わりに使います。
@param len 文字列の長さを整数で指定します。 -
Fiddle
:: Pointer # to _ str(len) -> String (18205.0) -
自身が指す領域から長さ len の文字列を複製して返します。
自身が指す領域から長さ len の文字列を複製して返します。
len を省略した場合は、self.size をその代わりに使います。
@param len 文字列の長さを整数で指定します。 -
IPAddr
# to _ string -> String (12309.0) -
標準的な文字列表現に変換します。
...標準的な文字列表現に変換します。
require 'ipaddr'
addr6 = IPAddr.new('::1')
addr6.to_s #=> "::1"
addr6.to_string #=> "0000:0000:0000:0000:0000:0000:0000:0001"
@see IPAddr#to_s... -
REXML
:: Attribute # to _ string -> String (12309.0) -
"name='value'" という形式の文字列を返します。
..."name='value'" という形式の文字列を返します。
//emlist[][ruby]{
require 'rexml/document'
e = REXML::Element.new("el")
e.add_attribute("ns:r", "rval")
p e.attributes.get_attribute("r").to_string # => "ns:r='rval'"
//}...