RbRuby · Lesson 6 of 11
Strings & Regex
Ruby's String class has over 100 methods. This is either brilliant or insane, but either way you won't need to import anything.
✦ Tip
Prefer single-quoted strings when there's no interpolation — `'hello'` instead of `"hello"`. Ruby skips processing escape sequences and interpolation for single-quoted strings, which is marginally faster and signals intent clearly. Use double quotes when you need `#{...}` or `\n`.
Prefer single-quoted strings when there's no interpolation — `'hello'` instead of `"hello"`. Ruby skips processing escape sequences and interpolation for single-quoted strings, which is marginally faster and signals intent clearly. Use double quotes when you need `#{...}` or `\n`.