String Manipulation

Ruby string functions and features

#String Manipulation#

Strip a string

To trim the whitespace off a string you can run the following:

my_string = " oh boy "

# To trim into another variable
my_trimmed_string = my_string.strip

# To trim in place
my_string.strip!

Next: Classes and Modules