How I may help
LinkedIn Profile Email me!
Call me using Skype client on your machine

Reload this page Programming Escape Characters

This page examines the nuances of escape characters used in C and Java program coding.

Sound: Pool balls breaking

 

Topics this page:

  • Escape Characters
  • End of Line Chars
  • Setting Escape Switch
  • Your comments???
  • Related:

  • Java Programming
  • Literal Data Types
  • Languages
  • Applications Development
  • On the web
  •  

    Site Map List all pages on this site 
    About this site About this site 
    Go to first topic Go to Bottom of this page


    Set screen Escape characters

      Escape
      Sequence
      Description VB
      Constant
      Decimal
      HTML
      Octal
      ASCII
      Hex Unicode

      \b

      Backspace vbBack 8 010 08 \u0008

      \t

      (Horizontal) Tab vbTab 9 011 09 \u0009

      \n

      New Line Feed (LF) vbLf
      vbNewLine
      10 012 0A \u000a

      \v

      Vertical Tab vbVerticalTab 11 013 0B \u000B

      \f

      Form Feed vbFormFeed 12 014 0C \u000c

      \r

      Carriage Return (CR) vbCr 13 015 0D \u000d

      \\

      Back slash (solidus) - 092 134 5C \u005c

      \'

      Single quote (grave accent) - 39 047 27 \u0027

      \"

      Double quote - 34 042 22 \u0022

      \0

      null (C string terminator) vbNullChar - -   \u0000

       

      null (Empty) string vbNullString 0 000 00 -

      \c

      continuation (UNIX)          

      \a

      Alert (beep/bell sound) or New line break for CSS2 content   7 7 07 \u0007

      \s

      Space   32 040 20  

      \e

      Escape   27 033 1B \u001B

       

      infinity(INF) - ? 236 EC \u221E
      \u8734

      See http://www.asciitable.com/ or http://www.table-ascii.com.

      PHP programs also need escaped dollars signs (which precede variable names), braces, and brackets (which have special meaning in PHP):
      \$ \{ \} \[ \]

      In DOS batch files, the character like the backslash in Linux is the carrot, which tells the command interpreter to see the next character as a conventional character. An example usage is this:

        @echo off
        set username=josh
        echo ^<%username%@mail.com^> >> emaillist.txt
        


    Go to Top of this page.
    Next topic this page

    Set screen End of Line characters

      Each platform has a different convention is for terminating lines:

      • On Unix, an ASCII newline (\n) LF (linefeed) character ends each line.
      • On Windows, an ASCII sequence CR LF (\r\n) (return followed by linefeed) ends each line.
      • On Macintosh, an ASCII CR (\r) (carriage return) character ends each line.

      Within UNIX, convert DOS newlines (CR/LF) to Unix format with this regular expression command:

        sed 's/.$//' file # assumes that all lines end with CR/LF

      Within DOS, convert Unix newlines (LF) to DOS \r\n format with one of these two regular expression commands:

        sed 's/$//' file # method 1
        sed -n p file # method 2

      tool Use this standard utility:

        dos2unix fromfile1 tofile

      tool Flip-xp.exe is a FREE command-line utility you can download to your Windows\System32 folder to display (-t) or convert ASCII files to Unix (-u) or to Windows (-d) or to Macintosh (-m).


    Go to Top of this page.
    Next topic this page

    Set screen Removing Trailing Characters

      Starting with Python 2.2, to remove all occurances of any line terminator from the end of the string S without removing other trailing whitespace:

        S.rstrip("\r\n")

      This is similar to Perl's chomp().


    Go to Top of this page.
    Next topic this page

    Set screen Setting Escape characters

      Oracleanother page on this site SQLPLUS recognizes the & ampersand character as a substitution character for data input.

      So to store a string such as "Johnson & Son" into an Oracle table, use an escape character, as in 'Johnson \& Son' (with the \&).

      But first turn on escape character processing:

      SQL> set escape \


    Go to Top of this page.
    Next topic this page

    Set screen Use in UNIX Shells

      UNIX Korn shells use the \c escape character to signal continuation (no automatic line break):

        echo "Enter the path to the data file: \c"


    Go to Top of this page.
    Next topic this page

    Portions ©Copyright 1996-2011 Wilson Mar. All rights reserved. | Privacy Policy |


    How I may help

    Send a message with your email client program Thank you!