...

/

Untitled Masterpiece

Learn to use popular built-in Methods related to strings and arrays in Ruby.

Built-in methods for strings

Ruby provides various built-in Methods for dealing with strings. These methods are collectively called string methods.

Note: All string methods return a new string without changing the original one.

There are numerous tasks related to strings that make it easy for programmers to perform routine tasks. This section will provide examples and results of some commonly used string methods.

The methods related to case change

These methods change the letter case of the text stored in a string (say, from lowercase to uppercase). Let’s use an example program to explore case changes.

  • The capitalize() method converts the first character of the string to uppercase.
  • The downcase() method converts all characters in
...