C# Class SpeakFriend.Utilities.StringExtension

Afficher le fichier Open project: teamaton/speak-lib

Méthodes publiques

Méthode Description
EnsureEndsNotWith ( this value, string suffix ) : string

Returns a new string which is guaranteed not to end with the given suffix. If the suffix is already missing, the same string is returned.

EnsureEndsNotWith ( this value, string suffix, bool ignoreCase ) : string
EnsureEndsWith ( this value, string suffix ) : string

Returns a new string which is guaranteed to end with the given suffix. If the suffix is already present, the same string is returned.

EnsureEndsWith ( this value, string suffix, StringEnsureOptions options ) : string
EnsureStartsNotWith ( this value, string prefix ) : string

Returns a new string which is guaranteed not to begin with the given prefix. If the prefix is already missing, the same string is returned.

EnsureStartsWith ( this value, string prefix ) : string

Returns a new string which is guaranteed to begin with the given prefix. If the prefix is already present, the same string is returned.

EnsureStartsWith ( this value, string prefix, StringEnsureOptions options ) : string
Indent ( this value, int width ) : string
IsEmail ( this text ) : bool
IsNumeric ( this value ) : bool
IsUri ( this uri ) : bool
JoinNonEmpty ( this values, string separator ) : string
ToDate ( this dateText ) : DateTime?
ToInt ( this value ) : int
ToInt32 ( this value ) : int
Truncate ( this text, int maxLength ) : string

Truncates the string to a specified length and replace the truncated to a ...

Truncate ( this text, int maxLength, string suffix ) : string

Truncates the string to a specified length and replaces the truncated to a ...

WordWrap ( this text, int maxLineLength ) : List

Return a list of wrapped lines

Wrap ( this text, int maxLineLength ) : string

Returns the given text with lines separated by Environment.NewLine and a maximum length of maxLineLength. Uses WordWrap internally.

Method Details

EnsureEndsNotWith() public static méthode

Returns a new string which is guaranteed not to end with the given suffix. If the suffix is already missing, the same string is returned.
public static EnsureEndsNotWith ( this value, string suffix ) : string
value this
suffix string
Résultat string

EnsureEndsNotWith() public static méthode

public static EnsureEndsNotWith ( this value, string suffix, bool ignoreCase ) : string
value this
suffix string
ignoreCase bool
Résultat string

EnsureEndsWith() public static méthode

Returns a new string which is guaranteed to end with the given suffix. If the suffix is already present, the same string is returned.
public static EnsureEndsWith ( this value, string suffix ) : string
value this
suffix string
Résultat string

EnsureEndsWith() public static méthode

public static EnsureEndsWith ( this value, string suffix, StringEnsureOptions options ) : string
value this
suffix string
options StringEnsureOptions
Résultat string

EnsureStartsNotWith() public static méthode

Returns a new string which is guaranteed not to begin with the given prefix. If the prefix is already missing, the same string is returned.
public static EnsureStartsNotWith ( this value, string prefix ) : string
value this
prefix string
Résultat string

EnsureStartsWith() public static méthode

Returns a new string which is guaranteed to begin with the given prefix. If the prefix is already present, the same string is returned.
public static EnsureStartsWith ( this value, string prefix ) : string
value this
prefix string
Résultat string

EnsureStartsWith() public static méthode

public static EnsureStartsWith ( this value, string prefix, StringEnsureOptions options ) : string
value this
prefix string
options StringEnsureOptions
Résultat string

Indent() public static méthode

public static Indent ( this value, int width ) : string
value this
width int
Résultat string

IsEmail() public static méthode

public static IsEmail ( this text ) : bool
text this
Résultat bool

IsNumeric() public static méthode

public static IsNumeric ( this value ) : bool
value this
Résultat bool

IsUri() public static méthode

public static IsUri ( this uri ) : bool
uri this
Résultat bool

JoinNonEmpty() public static méthode

public static JoinNonEmpty ( this values, string separator ) : string
values this
separator string
Résultat string

ToDate() public static méthode

public static ToDate ( this dateText ) : DateTime?
dateText this
Résultat DateTime?

ToInt() public static méthode

public static ToInt ( this value ) : int
value this
Résultat int

ToInt32() public static méthode

public static ToInt32 ( this value ) : int
value this
Résultat int

Truncate() public static méthode

Truncates the string to a specified length and replace the truncated to a ...
public static Truncate ( this text, int maxLength ) : string
text this string that will be truncated
maxLength int total length of characters to maintain before the truncate happens
Résultat string

Truncate() public static méthode

Truncates the string to a specified length and replaces the truncated to a ...
public static Truncate ( this text, int maxLength, string suffix ) : string
text this string that will be truncated
maxLength int total length of characters to maintain before the truncate happens
suffix string
Résultat string

WordWrap() public static méthode

Return a list of wrapped lines
public static WordWrap ( this text, int maxLineLength ) : List
text this
maxLineLength int
Résultat List

Wrap() public static méthode

Returns the given text with lines separated by Environment.NewLine and a maximum length of maxLineLength. Uses WordWrap internally.
public static Wrap ( this text, int maxLineLength ) : string
text this
maxLineLength int
Résultat string