C# Class Loyc.Syntax.PrintHelpers

Static methods that help to print literals, such as EscapeCStyle which escapes special characters with backslashes.
Exibir arquivo Open project: qwertie/ecsharp Class Usage Examples

Public Methods

Method Description
AppendIntegerTo ( StringBuilder target, long value, string prefix = "", int @base = 10, int separatorInterval = 3, char separatorChar = '_' ) : StringBuilder

Same as IntegerToString(long, string, int, int, char) except that the target StringBuilder must be provided as a parameter.

AppendIntegerTo ( StringBuilder target, ulong value, string prefix = "", int @base = 10, int separatorInterval = 3, char separatorChar = '_' ) : StringBuilder
EscapeCStyle ( int c, StringBuilder @out, EscapeC flags = EscapeC.Default, char quoteType = '\0' ) : bool

Writes a character c to a StringBuilder, either as a normal character or as a C-style escape sequence.

EscapeC.HasLongEscape can be used to force a 6-digit unicode escape; this may be needed if the next character after this one is a digit.

EscapeCStyle ( UString s, EscapeC flags = EscapeC.Default ) : string

Escapes characters in a string using C style, e.g. the string "Foo\"\n" maps to "Foo\\\"\\\n" by default.

EscapeCStyle ( UString s, EscapeC flags, char quoteType ) : string

Escapes characters in a string using C style.

HexDigitChar ( int value ) : char

Gets the hex digit character for the specified value, or '?' if the value is not in the range 0...15. Uses uppercase.

IntegerToString ( long value, string prefix = "", int @base = 10, int separatorInterval = 3, char separatorChar = '_' ) : string

Converts an integer to a string, optionally with separator characters for readability.

Example: IntegerToString(-1234567, "0", 10, 3, '\'') == "-01'234'567"

IntegerToString ( ulong value, string prefix = "", int @base = 10, int separatorInterval = 3, char separatorChar = '_' ) : string

Private Methods

Method Description
EscapeU ( int c, StringBuilder @out, EscapeC flags ) : void

Method Details

AppendIntegerTo() public static method

Same as IntegerToString(long, string, int, int, char) except that the target StringBuilder must be provided as a parameter.
public static AppendIntegerTo ( StringBuilder target, long value, string prefix = "", int @base = 10, int separatorInterval = 3, char separatorChar = '_' ) : StringBuilder
target StringBuilder
value long Integer to be converted
prefix string A prefix to insert before the number, but after the '-' sign, if any (e.g. "0x" for hex). Use "" for no prefix.
@base int
separatorInterval int Number of digits in a group
separatorChar char Digit group separator
return StringBuilder

AppendIntegerTo() public static method

public static AppendIntegerTo ( StringBuilder target, ulong value, string prefix = "", int @base = 10, int separatorInterval = 3, char separatorChar = '_' ) : StringBuilder
target StringBuilder
value ulong
prefix string
@base int
separatorInterval int
separatorChar char
return StringBuilder

EscapeCStyle() public static method

Writes a character c to a StringBuilder, either as a normal character or as a C-style escape sequence.
EscapeC.HasLongEscape can be used to force a 6-digit unicode escape; this may be needed if the next character after this one is a digit.
public static EscapeCStyle ( int c, StringBuilder @out, EscapeC flags = EscapeC.Default, char quoteType = '\0' ) : bool
c int
@out StringBuilder
flags EscapeC Specifies which characters should be escaped.
quoteType char Specifies a character that should always be /// escaped (typically one of ' " `)
return bool

EscapeCStyle() public static method

Escapes characters in a string using C style, e.g. the string "Foo\"\n" maps to "Foo\\\"\\\n" by default.
public static EscapeCStyle ( UString s, EscapeC flags = EscapeC.Default ) : string
s UString
flags EscapeC
return string

EscapeCStyle() public static method

Escapes characters in a string using C style.
public static EscapeCStyle ( UString s, EscapeC flags, char quoteType ) : string
s UString
flags EscapeC Specifies which characters should be escaped.
quoteType char Specifies a character that should always be /// escaped (typically one of ' " `)
return string

HexDigitChar() public static method

Gets the hex digit character for the specified value, or '?' if the value is not in the range 0...15. Uses uppercase.
public static HexDigitChar ( int value ) : char
value int
return char

IntegerToString() public static method

Converts an integer to a string, optionally with separator characters for readability.
Example: IntegerToString(-1234567, "0", 10, 3, '\'') == "-01'234'567"
public static IntegerToString ( long value, string prefix = "", int @base = 10, int separatorInterval = 3, char separatorChar = '_' ) : string
value long Integer to be converted
prefix string A prefix to insert before the number, but after the '-' sign, if any (e.g. "0x" for hex). Use "" for no prefix.
@base int
separatorInterval int Number of digits in a group
separatorChar char Digit group separator
return string

IntegerToString() public static method

public static IntegerToString ( ulong value, string prefix = "", int @base = 10, int separatorInterval = 3, char separatorChar = '_' ) : string
value ulong
prefix string
@base int
separatorInterval int
separatorChar char
return string