C# Class BinaryStudio.ClientManager.DomainModel.Infrastructure.StringExtensions

显示文件 Open project: titarenko/ClientManager

Public Methods

Method Description
Cut ( this line, int maxLength ) : string

If string is more then maximum length then it will be cutten for maximum length and last 3 symbols will be changed for "..." string s="This is string"; var result=s.Cut(7); //result will be equal "This..."

Fill ( this format ) : string

Fill string if it is a format string with current arguments.

IsNullOrEmpty ( this line ) : bool

Check if string is empty, or is null or is only spaces in it.

Or ( this line, string defaultValue ) : string

Check if string is empty, or null or only spaces in it then return default value. Otherwise return current string.

Method Details

Cut() public static method

If string is more then maximum length then it will be cutten for maximum length and last 3 symbols will be changed for "..." string s="This is string"; var result=s.Cut(7); //result will be equal "This..."
public static Cut ( this line, int maxLength ) : string
line this
maxLength int Maximum length of string
return string

Fill() public static method

Fill string if it is a format string with current arguments.
public static Fill ( this format ) : string
format this
return string

IsNullOrEmpty() public static method

Check if string is empty, or is null or is only spaces in it.
public static IsNullOrEmpty ( this line ) : bool
line this
return bool

Or() public static method

Check if string is empty, or null or only spaces in it then return default value. Otherwise return current string.
public static Or ( this line, string defaultValue ) : string
line this
defaultValue string Default value
return string