Comparing Strings : String comparisons « String « Ruby






Comparing Strings


You can do that with the == method. 


print "What was the question again?" if question == ""

 








Related examples in the same category

1.perform "greater than" and "less than" comparisons:
2.compare strings with the <=> method
3.A case-insensitive comparison is possible with casecmp, which has the same possible results as <=> (-1, 0, 1)
4.Comparing With Regular Expressions
5.string contains lowercase characters
6.string contains uppercase characters
7.string contains mixed case
8.string starts with a capital letter
9.Text Manipulation