LoginSignup
2
2

More than 1 year has passed since last update.

Rubyで文字列の長さを取得する

Posted at

Rubyで文字列の長さを取得するサンプルプログラムです。

input_line = gets.chomp
num = input_line.length
puts num

文字列の長さは

num = input_line.length    

lengthプロパティを使います。

2
2
2

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
2
2