C# 클래스 CK.Text.StringAndStringBuilderExtension

Defines useful extension methods on string and StringBuilder.
파일 보기 프로젝트 열기: Invenietis/ck-core

공개 메소드들

메소드 설명
Append ( this @this, string s, int repeatCount ) : StringBuilder

Appends multiple time the same string.

AppendMultiLine ( this @this, string prefix, string text, bool prefixOnFirstLine, bool prefixLastEmptyLine = false ) : StringBuilder

Appends a block of text to this StringBuilder with a prefix on each line. b.AppendMultiLine( prefix, text, false, true ) is the same as the naive approach, that is to add text.Replace( Environment.NewLine, Environment.NewLine + prefix ). This method is faster (in release build), normalizes EOL (\n, \r and \r\n) to Environment.NewLine and offer a better and easier control with its parameters prefixOnFirstLine and prefixLastEmptyLine.

AppendStrings ( this @this, IEnumerable strings, string separator = ", " ) : StringBuilder

Appends a set of strings with an internal separator. (This should be named 'Append' but appropriate overload is not always detected by the compiler.)

Concatenate ( this @this, string separator = ", " ) : string

Concatenates multiple strings with an internal separator.

HexDigitValue ( this c ) : int

Gets the value (0...15) for this character ('0'...'9', 'a'...'f' or 'A.'..'F'), or -1 if this is not an hexadecimal digit.

NormalizeEOL ( this @this ) : string

Returns a string where \r\n or \n alone are normalized to Environment.NewLine.

NormalizeEOLToCRLF ( this @this ) : string

Returns a string where \n alone are normalized to \r\n.

NormalizeEOLToLF ( this @this ) : string

Returns a string where \r\n are normalized to \n.

메소드 상세

Append() 공개 정적인 메소드

Appends multiple time the same string.
public static Append ( this @this, string s, int repeatCount ) : StringBuilder
@this this
s string The string to repeat. Can be null.
repeatCount int The number of repetition.
리턴 StringBuilder

AppendMultiLine() 공개 정적인 메소드

Appends a block of text to this StringBuilder with a prefix on each line. b.AppendMultiLine( prefix, text, false, true ) is the same as the naive approach, that is to add text.Replace( Environment.NewLine, Environment.NewLine + prefix ). This method is faster (in release build), normalizes EOL (\n, \r and \r\n) to Environment.NewLine and offer a better and easier control with its parameters prefixOnFirstLine and prefixLastEmptyLine.
public static AppendMultiLine ( this @this, string prefix, string text, bool prefixOnFirstLine, bool prefixLastEmptyLine = false ) : StringBuilder
@this this
prefix string The prefix to add. When null or empty, the text is appended as-is.
text string The multiple lines text to append. Can be null or empty.
prefixOnFirstLine bool True to append the prefix to the first line. False to skip this first prefix.
prefixLastEmptyLine bool /// True to append the prefix to the last empty line (when the text ends with an EOL). /// By default, when text ends with a EOL, it is ignored. ///
리턴 StringBuilder

AppendStrings() 공개 정적인 메소드

Appends a set of strings with an internal separator. (This should be named 'Append' but appropriate overload is not always detected by the compiler.)
public static AppendStrings ( this @this, IEnumerable strings, string separator = ", " ) : StringBuilder
@this this
strings IEnumerable Set of strings. Can be null.
separator string The separator string.
리턴 StringBuilder

Concatenate() 공개 정적인 메소드

Concatenates multiple strings with an internal separator.
public static Concatenate ( this @this, string separator = ", " ) : string
@this this
separator string The separator string.
리턴 string

HexDigitValue() 공개 정적인 메소드

Gets the value (0...15) for this character ('0'...'9', 'a'...'f' or 'A.'..'F'), or -1 if this is not an hexadecimal digit.
public static HexDigitValue ( this c ) : int
c this This character.
리턴 int

NormalizeEOL() 공개 정적인 메소드

Returns a string where \r\n or \n alone are normalized to Environment.NewLine.
public static NormalizeEOL ( this @this ) : string
@this this
리턴 string

NormalizeEOLToCRLF() 공개 정적인 메소드

Returns a string where \n alone are normalized to \r\n.
public static NormalizeEOLToCRLF ( this @this ) : string
@this this
리턴 string

NormalizeEOLToLF() 공개 정적인 메소드

Returns a string where \r\n are normalized to \n.
public static NormalizeEOLToLF ( this @this ) : string
@this this
리턴 string