文字列を比較
Top > Ruby [2.2.2] > < , == , <=>
p "a" < "b" # true p "b" < "b" # false p "b" <= "b" # true p "a" == "b" # false p "b" == "b" # true p "a" <=> "b" # -1 ←左が大きい時 p "a" <=> "a" # 0 ←同じ時 p "c" <=> "b" # 1 ←右が大きい時 p "azz" < "aaz" # false p "zaa" < "zba" # true