Class NewLine
- Namespace
- ICSharpCode.Decompiler.Util
- Assembly
- ICSharpCode.Decompiler.dll
Defines unicode new lines according to Unicode Technical Report #13 http://www.unicode.org/standard/reports/tr13/tr13-5.html
public static class NewLine
- Inheritance
-
NewLine
- Inherited Members
Fields
CR
Carriage Return, U+000D
public const char CR = '\r'
Field Value
FF
Form Feed, U+000C
public const char FF = '\f'
Field Value
LF
Line Feed, U+000A
public const char LF = '\n'
Field Value
LS
Line Separator, U+2028
public const char LS = '\u2028'
Field Value
NEL
Next Line, U+0085
public const char NEL = '\u0085'
Field Value
PS
Paragraph Separator, U+2029
public const char PS = '\u2029'
Field Value
VT
Vertical Tab, U+000B
public const char VT = '\v'
Field Value
Methods
GetDelimiterLength(char, char)
Determines if a char is a new line delimiter.
public static int GetDelimiterLength(char curChar, char nextChar)
Parameters
curChar
charThe current character.
nextChar
charThe next character (if != LF then length will always be 0 or 1).
Returns
- int
0 == no new line, otherwise it returns either 1 or 2 depending of the length of the delimiter.
GetDelimiterLength(char, Func<char>?)
Determines if a char is a new line delimiter.
public static int GetDelimiterLength(char curChar, Func<char>? nextChar = null)
Parameters
curChar
charThe current character.
nextChar
Func<char>A callback getting the next character (may be null).
Returns
- int
0 == no new line, otherwise it returns either 1 or 2 depending of the length of the delimiter.
GetDelimiterType(char, char)
Gets the new line type of a given char/next char.
public static UnicodeNewline GetDelimiterType(char curChar, char nextChar)
Parameters
curChar
charThe current character.
nextChar
charThe next character (if != LF then length will always be 0 or 1).
Returns
- UnicodeNewline
0 == no new line, otherwise it returns either 1 or 2 depending of the length of the delimiter.
GetDelimiterType(char, Func<char>?)
Gets the new line type of a given char/next char.
public static UnicodeNewline GetDelimiterType(char curChar, Func<char>? nextChar = null)
Parameters
curChar
charThe current character.
nextChar
Func<char>A callback getting the next character (may be null).
Returns
- UnicodeNewline
0 == no new line, otherwise it returns either 1 or 2 depending of the length of the delimiter.
GetString(UnicodeNewline)
Gets the new line as a string.
public static string GetString(UnicodeNewline newLine)
Parameters
newLine
UnicodeNewline
Returns
IsNewLine(char)
Determines if a char is a new line delimiter.
Note that the only 2 char wide new line is CR LF and both chars are new line chars on their own. For most cases GetDelimiterLength is the better choice.
public static bool IsNewLine(char ch)
Parameters
ch
char
Returns
TryGetDelimiterLengthAndType(char, out int, out UnicodeNewline, char)
Determines if a char is a new line delimiter.
public static bool TryGetDelimiterLengthAndType(char curChar, out int length, out UnicodeNewline type, char nextChar)
Parameters
curChar
charThe current character.
length
intThe length of the delimiter
type
UnicodeNewlineThe type of the delimiter
nextChar
charThe next character (if != LF then length will always be 0 or 1).
Returns
- bool
0 == no new line, otherwise it returns either 1 or 2 depending of the length of the delimiter.
TryGetDelimiterLengthAndType(char, out int, out UnicodeNewline, Func<char>?)
Determines if a char is a new line delimiter.
public static bool TryGetDelimiterLengthAndType(char curChar, out int length, out UnicodeNewline type, Func<char>? nextChar = null)
Parameters
curChar
charThe current character.
length
intThe length of the delimiter
type
UnicodeNewlineThe type of the delimiter
nextChar
Func<char>A callback getting the next character (may be null).
Returns
- bool
0 == no new line, otherwise it returns either 1 or 2 depending of the length of the delimiter.