The following table provides a recap of the common used string methods.
Expression | Output |
---|---|
"Test" + "Test" | TestTest |
"Test".capitalize | Test |
"Test".downcase | test |
"Test".chop | Tes |
"Test".next | Tesu |
"Test".reverse | tseT |
"Test".sum | 416 |
"Test".swapcase | tEST |
"Test".upcase | TEST |
"Test".upcase.reverse | TSET |
"Test".upcase.reverse.next | TSEU |
puts "This is a test".length