Dokumentation zu: escape(LPC)

HR Image


CONCEPT
        character escape codes

DESCRIPTION
	Character escape codes are used to represent some common
	special characters that would be awkward or impossible to
	enter in the source program directly. The escape characters
	come in two varieties: 'character escapes', which can be
	used to represent some particular formatting and special
	characters, and 'numeric escapes', which allow a character to
	be specified by its numeric encoding.

	Escapes begin always with a backslash '\'. If the following
	characters could not be treated as a valid escape the backslash
	is merely ignored.

	The following character escapes are available in LPC (the code
	may differ from platform to platform):

	  \a    Code 007    Bell
          \b    Code 008    Backspace
          \e    Code 027    Escape
	  \f    Code 012    Formfeed
	  \n    Code 010    Newline
	  \r    Code 013    Carriage-Return
	  \t    Code 009    Tabulator
	  \\    Code 092    Backslash itself
	  \'    Code 039    Single quote
	  \"    Code 034    Double quote

	The single quote may appear without preceding backslash in character
	constants, and the double quote may appear without a backslash in
	string constants.

	The numeric escapes could be used to express a character directly
	by its code in binary, octal, decimal or hexadecimal notation.
	
	  \0b     Beginning of binary notation
	  \0o     Beginning of octal notation
	  \0x     Beginning of hexadecimal notation
	  \x      Beginning of hexadecimal notation
	  \u, \U  Beginning of extended hexadecimal notation

	A backslash followed by a digit ([0-9]) which does not map to one
	of the above starts an escape in decimal notation.

	A numeric escape terminates when N digits have been used up or
	when the first character that is not a valid digit in that
	notation is encountered. N is 2 for hexadeximals with \0x and \x,
	3 for decimals and octals, 4 for hexadecimals with \u,
	8 for binarys and for hexadecimals with \U.

	If the specified code is greater than 255 a warning is issued and
	the value modulo 256 is used (except for \u and \U).

EXAMPLES
	Put a newline at the end of user output
	  "You enter.\n"

	Alert the user
	  "Beeep.\a Wake up\n"

	Put a double quote in a string
	  "You say \"hello\"\n"

	Write the line from above
	  "\"You say \\\"hello\\\"\\n\""

	Put a single quote in a string
	  "You say 'hello'\n"

	Some forms to write "abcde"
	  "abcde"
	  "ab\99de"              (with c's code being 99)
	  "ab\099de"
	  "ab\x63de"             (99 = 0x63)
	  "ab\0x63de"

	The following string consists of two characters
	  "\0111"                (\011 and 1)

	The following string consists of three characters
	  "\0o090"               (\000 and 9 and 0)


Start » Magierhandbuch » Docu » LPC » Escape Letzte Generierung: 25.04.2021, 01:58
Email an: mud@wl.mud.de
Valid HTML 4.01!