種類
- インスタンスメソッド (2404)
- 特異メソッド (43)
ライブラリ
- ビルトイン (2183)
-
bigdecimal
/ util (12) - csv (12)
- kconv (144)
- rake (60)
- scanf (12)
- shellwords (24)
キーワード
- % (12)
- * (12)
- + (12)
- +@ (10)
- -@ (10)
- << (12)
- <=> (12)
- == (12)
- === (12)
- =~ (12)
- [] (72)
- []= (84)
-
ascii
_ only? (12) - b (12)
- byteindex (3)
- byterindex (3)
- bytes (24)
- bytesize (12)
- byteslice (36)
- bytesplice (10)
- capitalize (12)
- capitalize! (12)
- casecmp (12)
- casecmp? (9)
- center (12)
- chars (24)
- chomp (12)
- chomp! (12)
- chop (12)
- chop! (12)
- chr (12)
- clear (12)
- codepoints (24)
- concat (21)
- count (12)
- crypt (12)
- dedup (3)
- delete (12)
- delete! (12)
-
delete
_ prefix (8) -
delete
_ prefix! (8) -
delete
_ suffix (8) -
delete
_ suffix! (8) - downcase (12)
- downcase! (12)
- dump (12)
-
each
_ byte (24) -
each
_ char (24) -
each
_ codepoint (24) -
each
_ grapheme _ cluster (16) -
each
_ line (24) - empty? (12)
- encode (36)
- encode! (24)
- encoding (12)
-
end
_ with? (12) - eql? (12)
- ext (12)
-
force
_ encoding (12) - getbyte (12)
-
grapheme
_ clusters (16) - gsub (48)
- gsub! (48)
- hash (12)
- hex (12)
- include? (12)
- index (12)
- insert (12)
- inspect (12)
- intern (12)
- iseuc (12)
- isjis (12)
- issjis (12)
- isutf8 (12)
- kconv (12)
- length (12)
- lines (24)
- ljust (12)
- lstrip (12)
- lstrip! (12)
- match (24)
- match? (9)
- new (31)
- next (12)
- next! (12)
- oct (12)
- ord (12)
-
parse
_ csv (12) - partition (12)
- pathmap (12)
-
pathmap
_ explode (12) -
pathmap
_ partial (12) -
pathmap
_ replace (12) - prepend (21)
- replace (12)
- reverse (12)
- reverse! (12)
- rindex (12)
- rjust (12)
- rpartition (12)
- rstrip (12)
- rstrip! (12)
- scan (24)
- scanf (12)
- scrub (36)
- scrub! (36)
- setbyte (12)
- shellescape (12)
- shellsplit (12)
- size (12)
- slice (72)
- slice! (72)
- split (19)
- squeeze (12)
- squeeze! (12)
-
start
_ with? (12) - strip (12)
- strip! (12)
- sub (36)
- sub! (36)
- succ (12)
- succ! (12)
- sum (12)
- swapcase (12)
- swapcase! (12)
-
to
_ c (12) -
to
_ d (12) -
to
_ f (12) -
to
_ i (12) -
to
_ r (12) -
to
_ s (12) -
to
_ str (12) -
to
_ sym (12) - toeuc (12)
- tojis (12)
- tolocale (12)
- tosjis (12)
- toutf16 (12)
- toutf32 (12)
- toutf8 (12)
- tr (12)
- tr! (12)
-
tr
_ s (12) -
tr
_ s! (12) -
try
_ convert (12) - undump (8)
-
unicode
_ normalize (11) -
unicode
_ normalize! (11) -
unicode
_ normalized? (11) - unpack (12)
- unpack1 (9)
- upcase (12)
- upcase! (12)
- upto (12)
-
valid
_ encoding? (12)
検索結果
先頭5件
-
String
# %(args) -> String (1.0) -
printf と同じ規則に従って args をフォーマットします。
...sprintf("%c", 'a') #=> "a"
//}
フラグ `-' と幅 の指定だけが意味を持ちます。
: s
文字列を出力します。
引数が String オブジェクトでなければ to_s メソッドにより文字列化
したものを引数として扱います。
: p
Object#inspect の... -
String
# *(times) -> String (1.0) -
文字列の内容を times 回だけ繰り返した新しい文字列を作成して返します。
文字列の内容を times 回だけ繰り返した新しい文字列を作成して返します。
@param times 整数
@return self を times 回繰り返した新しい文字列
@raise ArgumentError 引数に負数を指定したときに発生します。
//emlist[例][ruby]{
p "str" * 3 # => "strstrstr"
str = "abc"
p str * 4 # => "abcabcabcabc"
p str * 0 # => ""
p str # => "abc" (変化なし)
//} -
String
# +(other) -> String (1.0) -
文字列と other を連結した新しい文字列を返します。
...er を連結した新しい文字列を返します。
@param other 文字列
@return self と other を連結した文字列
//emlist[例][ruby]{
p "str" + "ing" # => "string"
a = "abc"
b = "def"
p a + b # => "abcdef"
p a # => "abc" (変化なし)
p b # => "def"
//}... -
String
# +@ -> String | self (1.0) -
self が freeze されている文字列の場合、元の文字列の複製を返します。 freeze されていない場合は self を返します。
...の場合、元の文字列の複製を返します。
freeze されていない場合は self を返します。
//emlist[例][ruby]{
# frozen_string_literal: false
original_text = "text"
unfrozen_text = +original_text
unfrozen_text.frozen? # => false
original_text == unfrozen_tex......t # => 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 (1.0) -
self が freeze されている文字列の場合、self を返します。 freeze されていない場合は元の文字列の 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
original_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
# <<(other) -> self (1.0) -
self に文字列 other を破壊的に連結します。 other が 整数である場合は other.chr(self.encoding) 相当の文字を末尾に追加します。
...追加します。
self を返します。
@param other 文字列もしくは 0 以上の整数
//emlist[例][ruby]{
str = "string"
str.concat "XXX"
p str # => "stringXXX"
str << "YYY"
p str # => "stringXXXYYY"
str << 65 # 文字AのASCIIコード
p str # => "stringXXXYYYA"
//}... -
String
# <=>(other) -> -1 | 0 | 1 | nil (1.0) -
self と other を ASCII コード順で比較して、 self が大きい時には 1、等しい時には 0、小さい時には -1 を返します。 このメソッドは Comparable モジュールのメソッドを実装するために使われます。
...します。
@param other 文字列
@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
//}... -
String
# ==(other) -> bool (1.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 (1.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?...