develop with

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

comments powered by Disqus

Want to see a topic covered? create a suggestion

Get more developer references and books in the developwith store.