C# Class csShared.Utils.StringUtils

显示文件 Open project: TNOCS/csTouch

Public Methods

Method Description
AppendIfExists ( string div, string val ) : string
CompareAlphaNumeric ( string a, string b ) : int

Comparison delegate for strings that contain letters and numbers. Improves upon standard string comparisons where "A11" comes before "A2". Usage: Array.Sort(list, StringUtils.CompareAlphaNumeric);

ExtractNumber ( string numStr ) : int
FindNumericEnd ( int start, string numStr ) : int
FindNumericEnd ( string numStr ) : int
FindNumericStart ( string numStr ) : int
GetSmartPlural ( int num, string noun ) : string

Get phrase in present tense: e.g. there "are no boxes" selected; there "is one box" selected; there "are 5 boxes" selected

GetSmartPlural ( int num, string noun, string addToMakePlural ) : string
GetSmartPluralPastTense ( int num, string noun ) : string

Get phrase in past tense: e.g. "no boxes were" selected; "one box was" selected; "5 boxes were" selected

GetSmartPluralPastTense ( int num, string noun, string addToMakePlural ) : string
IsAlphaNumeric ( char x ) : bool
IsAlphaNumeric ( string x ) : bool
IsNumeric ( object expression ) : bool
Join ( IEnumerable list, string delim ) : string
RemoveExcessWhiteSpace ( string str ) : string
RemoveFromFront ( string str, string frontStr ) : string
RenameFolder ( string oldDirPath, string proposedName ) : string
Split ( string str, string delim ) : string[]
SplitToList ( string str, string delim ) : List
SplitToList ( string str, string delim, bool trim ) : List
SubstringAlphaNumericAtPosition ( string str, int pos ) : string
SubstringBetween ( string str, string start, string end ) : string
UppercaseFirst ( this s ) : string
WildcardEquals ( string pattern, string str ) : bool
WildcardEquals ( string pattern, string str, bool ignoreCase ) : bool

Private Methods

Method Description
CompareAlphaNumericNums ( string a, string b ) : int
WildcardEquals ( string pattern, int patternIdx, string stringRenamed, int stringIdx ) : bool

Method Details

AppendIfExists() public static method

public static AppendIfExists ( string div, string val ) : string
div string
val string
return string

CompareAlphaNumeric() public static method

Comparison delegate for strings that contain letters and numbers. Improves upon standard string comparisons where "A11" comes before "A2". Usage: Array.Sort(list, StringUtils.CompareAlphaNumeric);
public static CompareAlphaNumeric ( string a, string b ) : int
a string
b string
return int

ExtractNumber() public static method

public static ExtractNumber ( string numStr ) : int
numStr string
return int

FindNumericEnd() public static method

public static FindNumericEnd ( int start, string numStr ) : int
start int
numStr string
return int

FindNumericEnd() public static method

public static FindNumericEnd ( string numStr ) : int
numStr string
return int

FindNumericStart() public static method

public static FindNumericStart ( string numStr ) : int
numStr string
return int

GetSmartPlural() public static method

Get phrase in present tense: e.g. there "are no boxes" selected; there "is one box" selected; there "are 5 boxes" selected
public static GetSmartPlural ( int num, string noun ) : string
num int
noun string
return string

GetSmartPlural() public static method

public static GetSmartPlural ( int num, string noun, string addToMakePlural ) : string
num int
noun string
addToMakePlural string
return string

GetSmartPluralPastTense() public static method

Get phrase in past tense: e.g. "no boxes were" selected; "one box was" selected; "5 boxes were" selected
public static GetSmartPluralPastTense ( int num, string noun ) : string
num int
noun string
return string

GetSmartPluralPastTense() public static method

public static GetSmartPluralPastTense ( int num, string noun, string addToMakePlural ) : string
num int
noun string
addToMakePlural string
return string

IsAlphaNumeric() public static method

public static IsAlphaNumeric ( char x ) : bool
x char
return bool

IsAlphaNumeric() public static method

public static IsAlphaNumeric ( string x ) : bool
x string
return bool

IsNumeric() public static method

public static IsNumeric ( object expression ) : bool
expression object
return bool

Join() public static method

public static Join ( IEnumerable list, string delim ) : string
list IEnumerable
delim string
return string

RemoveExcessWhiteSpace() public static method

public static RemoveExcessWhiteSpace ( string str ) : string
str string
return string

RemoveFromFront() public static method

public static RemoveFromFront ( string str, string frontStr ) : string
str string
frontStr string
return string

RenameFolder() public static method

public static RenameFolder ( string oldDirPath, string proposedName ) : string
oldDirPath string
proposedName string
return string

Split() public static method

public static Split ( string str, string delim ) : string[]
str string
delim string
return string[]

SplitToList() public static method

public static SplitToList ( string str, string delim ) : List
str string
delim string
return List

SplitToList() public static method

public static SplitToList ( string str, string delim, bool trim ) : List
str string
delim string
trim bool
return List

SubstringAlphaNumericAtPosition() public static method

public static SubstringAlphaNumericAtPosition ( string str, int pos ) : string
str string
pos int
return string

SubstringBetween() public static method

public static SubstringBetween ( string str, string start, string end ) : string
str string
start string
end string
return string

UppercaseFirst() public static method

public static UppercaseFirst ( this s ) : string
s this
return string

WildcardEquals() public static method

public static WildcardEquals ( string pattern, string str ) : bool
pattern string
str string
return bool

WildcardEquals() public static method

public static WildcardEquals ( string pattern, string str, bool ignoreCase ) : bool
pattern string
str string
ignoreCase bool
return bool