Skip to content

Instantly share code, notes, and snippets.

@okram999
Created August 31, 2016 16:23
Show Gist options
  • Save okram999/654940891dff84364882535e12df8f87 to your computer and use it in GitHub Desktop.
Save okram999/654940891dff84364882535e12df8f87 to your computer and use it in GitHub Desktop.
This is all of the escape sequences Ruby supports. You may not use many of these, but memorize their format and what they do anyway. Try them out in some strings to see if you can make them work.
Escape What it does.
\\ Backslash ()
\' Single-quote (')
\" Double-quote (")
\a ASCII bell (BEL)
\b ASCII backspace (BS)
\f ASCII formfeed (FF)
\n ASCII linefeed (LF)
\r ASCII Carriage Return (CR)
\t ASCII Horizontal Tab (TAB)
\uxxxx Character with 16-bit hex value xxxx (Unicode only)
\v ASCII vertical tab (VT)
\ooo Character with octal value ooo
\xhh Character with hex value hh
https://learnrubythehardway.org/book/ex10.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment