Ruby - String String Methods

Introduction

The following table provides a recap of the common used string methods.

Expression Output
"Test" + "Test" TestTest
"Test".capitalizeTest
"Test".downcase test
"Test".chop Tes
"Test".next Tesu
"Test".reverse tseT
"Test".sum 416
"Test".swapcase tEST
"Test".upcaseTEST
"Test".upcase.reverseTSET
"Test".upcase.reverse.next TSEU

Demo

puts "This is a test".length

Result

Related Topics