Learn Ruby
String
3.9
Lesson

strip to remove extra whitespaces

Ruby provides strip method to remove extra whitespaces at the front and at the end. Run the code and you will see white spaces at the front and the end.

We can remove the leading and the trailing whitespace by using strip.