0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

数字を文字として表示する.to_s メソッド、整数(数字)として表す.to_iメソッド

Posted at

数字を文字として扱いたい場合

数字.to_s 

とする

具体的には

20.to_s

to_sの「S」はstring(文字列)の「S」より

数字を数字として扱う場合

数字.to_i

to_iの「i」はinteger(整数)の 「I」

また

#{数字}

とすると文字列の中にそのまま使うことができる

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?