るりまサーチ

最速Rubyリファレンスマニュアル検索!
37件ヒット [1-37件を表示] (0.079秒)
トップページ > クエリ:-[x] > クエリ:downcase[x] > クエリ:to_s[x]

別のキーワード

  1. _builtin downcase
  2. symbol downcase
  3. string downcase
  4. string downcase!
  5. _builtin downcase!

ライブラリ

クラス

キーワード

検索結果

String#to_s -> String (18237.0)

self を返します。

...uby]{
p "str".to_s # => "str"
p "str".to_str # => "str"
//}

このメソッドは、文字列を他のクラスのインスタンスと混ぜて処理したいときに有効です。
例えば返り値が文字列か nil であるメソッド some_method があるとき、
to_s
メソッド...
...を使うと以下のように統一的に処理できます。

//emlist[例][ruby]{
# some_method(5).downcase だと返り値が nil のときに
# エラーになるので to_s をはさむ
p some_method(5).to_s.downcase
//}...

Symbol#downcase -> Symbol (18225.0)

大文字を小文字に変換したシンボルを返します。

...大文字を小文字に変換したシンボルを返します。

(self.to_s.downcase.intern と同じです。)

:FOO.downcase #=> :foo

@see String#downcase...

Symbol#downcase(*options) -> Symbol (18225.0)

大文字を小文字に変換したシンボルを返します。

...大文字を小文字に変換したシンボルを返します。

(self.to_s.downcase.intern と同じです。)

:FOO.downcase #=> :foo

@see String#downcase...

String#to_str -> String (6237.0)

self を返します。

...uby]{
p "str".to_s # => "str"
p "str".to_str # => "str"
//}

このメソッドは、文字列を他のクラスのインスタンスと混ぜて処理したいときに有効です。
例えば返り値が文字列か nil であるメソッド some_method があるとき、
to_s
メソッド...
...を使うと以下のように統一的に処理できます。

//emlist[例][ruby]{
# some_method(5).downcase だと返り値が nil のときに
# エラーになるので to_s をはさむ
p some_method(5).to_s.downcase
//}...

NEWS for Ruby 3.0.0 (306.0)

NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...mlist{
def method_missing(meth, ...)
send(:"do_#{meth}", ...)
end
//}

* Pattern matching (`case/in`) is no longer experimental. 17260
* One-line pattern matching is redesigned. [EXPERIMENTAL]
* `=>` is added. It can be used like a rightward assignment.
17260
* `in...
...ng#center
* String#chomp
* String#chop
* String#delete
* String#delete_prefix
* String#delete_suffix
* String#downcase
* String#dump
* String#each_char
* String#each_grapheme_cluster
* String#each_line
* String#gsub
* String#lju...
...ysis performance, and usability.

//emlist[][ruby]{
# test.rb
def foo(x)
if x > 10
x.to_s
else
nil
end
end

foo(42)
//}

//emlist{
$ typeprof test.rb
# Classes
class Object
def foo : (Integer) -> String?
end
//}

== Miscellaneous changes

* Methods using `ruby2_keywords` will no lo...

絞り込み条件を変える