C# 클래스 ToolBelt.StringUtility

Groups a set of useful string manipulation and validation methods.
파일 보기 프로젝트 열기: jlyonsmith/ToolBelt

공개 메소드들

메소드 설명
ConvertEmptyToNull ( string value ) : string

Converts an empty string ("") to .

ConvertNullToEmpty ( string value ) : string

Converts to an empty string.

CultureFormat ( this format ) : string

Format a string using the current culture. Use for strings returned to user.

InvariantFormat ( this format ) : string

Format a string using the invariant culture. Use for persisted strings not returned to user.

Join ( string separator, IList value ) : string

Concatenates a specified separator string between each element of a specified list, yielding a single concatenated string.

For example if separator is ", " and the elements of value are "apple", "orange", "grape", and "pear", the method returns "apple, orange, grape, pear".

If separator is , an empty string (string.Empty) is used instead.

ReplaceTags ( this source, string tagPrefix, string tagSuffix, IDictionary tagDictionary, TaggedStringOptions flags = TaggedStringOptions.RemoveUnknownTags ) : string

This method searches for each occurrence of a tagged variable in source and replaces it with the value from the a dictionary subs. Comparisons are done case insensitively.

WordWrap ( this text, int lineLength ) : string[]

Breaks a string on word boundaries, to the given lineLength. Only space characters are considered when breaking up lines. Embedded Environment.NewLine sequences will break a line and are not included in the resulting output. Each line is broken after the first whitespace after the last word on the line, so all space characters are preserved in the resulting output.

메소드 상세

ConvertEmptyToNull() 공개 정적인 메소드

Converts an empty string ("") to .
public static ConvertEmptyToNull ( string value ) : string
value string The value to convert.
리턴 string

ConvertNullToEmpty() 공개 정적인 메소드

Converts to an empty string.
public static ConvertNullToEmpty ( string value ) : string
value string The value to convert.
리턴 string

CultureFormat() 공개 정적인 메소드

Format a string using the current culture. Use for strings returned to user.
public static CultureFormat ( this format ) : string
format this
리턴 string

InvariantFormat() 공개 정적인 메소드

Format a string using the invariant culture. Use for persisted strings not returned to user.
public static InvariantFormat ( this format ) : string
format this
리턴 string

Join() 공개 정적인 메소드

Concatenates a specified separator string between each element of a specified list, yielding a single concatenated string.

For example if separator is ", " and the elements of value are "apple", "orange", "grape", and "pear", the method returns "apple, orange, grape, pear".

If separator is , an empty string (string.Empty) is used instead.

public static Join ( string separator, IList value ) : string
separator string A .
value IList A string collection.
리턴 string

ReplaceTags() 공개 정적인 메소드

This method searches for each occurrence of a tagged variable in source and replaces it with the value from the a dictionary subs. Comparisons are done case insensitively.
public static ReplaceTags ( this source, string tagPrefix, string tagSuffix, IDictionary tagDictionary, TaggedStringOptions flags = TaggedStringOptions.RemoveUnknownTags ) : string
source this String containing tagged entities
tagPrefix string The tag prefix
tagSuffix string The tag suffix
tagDictionary IDictionary
flags TaggedStringOptions for the replace operation
리턴 string

WordWrap() 공개 정적인 메소드

Breaks a string on word boundaries, to the given lineLength. Only space characters are considered when breaking up lines. Embedded Environment.NewLine sequences will break a line and are not included in the resulting output. Each line is broken after the first whitespace after the last word on the line, so all space characters are preserved in the resulting output.
public static WordWrap ( this text, int lineLength ) : string[]
text this The text to break up.
lineLength int The maximum length of a line
리턴 string[]