Rubyで文字列の長さを取得するサンプルプログラムです。
input_line = gets.chomp
num = input_line.length
puts num
文字列の長さは
num = input_line.length
とlengthプロパティを使います。
More than 1 year has passed since last update.
Rubyで文字列の長さを取得するサンプルプログラムです。
input_line = gets.chomp
num = input_line.length
puts num
文字列の長さは
num = input_line.length
とlengthプロパティを使います。
Register as a new user and use Qiita more conveniently