Strings
Ruby strings are sequences of characters. They normally hold printable characters, but that isn’t a requirement; a string can also hold binary data. Strings are instances of class String and are often created using string literals—sequences of characters between delimiters.
Ruby has a lot of different ways to create string literals, which differ in how much processing is done on the characters in the string. One kind of processing is an escape sequence. An escape sequence allows you to represent data that is otherwise impossible to represent in the string. Escape sequences in Ruby start with a backslash (\).
The simplest literal in Ruby is the single-quoted string. Inside a single-quoted string, only two escape sequences are recognized. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access