On 09/16/2018 10:46 AM, yary wrote:
escape sequence

Hi All,

Once I knew what they were called, I found a list. It is for
Java, but I do believe most of its words in Parl6  And,
besides, the more grouchy members of comp.lang.perl.misc,
think Perl 6 is Java anyway.

Just added this:
RFE: May be have a section on Escape Characters?
https://github.com/perl6/doc/issues/2313

Thank you!
-T


https://en.wikipedia.org/wiki/Escape_character

    \'  single quote
    \"     double quote
    \\  backslash
    \n  new line
    \r  carriage return
    \t  tab
    \b  backspace
    \f  form feed
    \v  vertical tab (Internet Explorer 9 and older treats '\v
        as 'v instead of a vertical tab ('\x0B). If cross-browser
        compatibility is a concern, use \x0B instead of \v.)
    \0  null character (U+0000 NULL) (only if the next character
        is not a decimal digit; else it is an octal escape sequence)

Note that the \v and \0 escapes are not allowed in JSON strings.

$ p6 "say 'I am a single quote\'';"
I am a single quote'

$ p6 'say "I am a double quote\"";'
I am a double quote"

p6 'say "I am a backslash\\";'
I am a backslash\

$ p6 'say "<I am a newline\>";'
<I am a newline>

p6 'say "<I am a carraie return\r>";'
>I am a carraige return

$ p6 'say "<I am a tab\t>";'
<I am a tab  >

$ p6 'say "<I am a backspace\b>";'
<I am a backspac>

$ p6 'say "<I am a formfeed\f>";'
<I am a formfeed
                >
$ p6 'say "<I am a verticle tab\v>";'
===SORRY!=== Error while compiling -e
Unrecognized backslash sequence: '\v'

$ p6 'say "<I am a null\0>";'
<I am a null>

Reply via email to