C# Class Tup.Cobar4Net.Util.StringUtil

Mostra file Open project: tupunco/Tup.Cobar4Net

Public Methods

Method Description
CountChar ( string str, char c ) : int
Decode ( byte src, int offset, int length, string charset ) : string
Decode ( byte src, string charset ) : string
DumpAsHex ( byte src, int length ) : string
Encode ( string src, string charset ) : byte[]
EqualsIgnoreCase ( string str1, string str2 ) : bool
GetRandomString ( int size ) : string
Hash ( string s, int start, int end ) : long

×Ö·û´®hashËã·¨£ºs[0]*31^(n-1) + s[1]*31^(n-2) + ...

×Ö·û´®hashËã·¨£ºs[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]
ÆäÖÐs[]Ϊ×Ö·û´®µÄ×Ö·ûÊý×飬»»Ëã³É³ÌÐòµÄ±í´ïʽΪ£º
h = 31*h + s.charAt(i); => h = (h << 5) - h + s.charAt( i); & lt; br>

HexString2Bytes ( char hexString, int offset, int length ) : byte[]
IsEmpty ( string str ) : bool
Replace ( string text, string repl, string with ) : string
Replace ( string text, string repl, string with, int max ) : string
ReplaceChars ( string str, char searchChar, char replaceChar ) : string
ReplaceChars ( string str, string searchChars, string replaceChars ) : string
ReplaceOnce ( string text, string repl, string with ) : string
SafeToString ( object @object ) : string
ToString ( byte bytes ) : string

Method Details

CountChar() public static method

public static CountChar ( string str, char c ) : int
str string
c char
return int

Decode() public static method

public static Decode ( byte src, int offset, int length, string charset ) : string
src byte
offset int
length int
charset string
return string

Decode() public static method

public static Decode ( byte src, string charset ) : string
src byte
charset string
return string

DumpAsHex() public static method

public static DumpAsHex ( byte src, int length ) : string
src byte
length int
return string

Encode() public static method

public static Encode ( string src, string charset ) : byte[]
src string
charset string
return byte[]

EqualsIgnoreCase() public static method

public static EqualsIgnoreCase ( string str1, string str2 ) : bool
str1 string
str2 string
return bool

GetRandomString() public static method

public static GetRandomString ( int size ) : string
size int
return string

Hash() public static method

×Ö·û´®hashËã·¨£ºs[0]*31^(n-1) + s[1]*31^(n-2) + ...
×Ö·û´®hashËã·¨£ºs[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]
ÆäÖÐs[]Ϊ×Ö·û´®µÄ×Ö·ûÊý×飬»»Ëã³É³ÌÐòµÄ±í´ïʽΪ£º
h = 31*h + s.charAt(i); => h = (h << 5) - h + s.charAt( i); & lt; br>
public static Hash ( string s, int start, int end ) : long
s string
start int hash for s.substring(start, end)
end int hash for s.substring(start, end)
return long

HexString2Bytes() public static method

public static HexString2Bytes ( char hexString, int offset, int length ) : byte[]
hexString char
offset int
length int
return byte[]

IsEmpty() public static method

public static IsEmpty ( string str ) : bool
str string
return bool

Replace() public static method

public static Replace ( string text, string repl, string with ) : string
text string
repl string
with string
return string

Replace() public static method

public static Replace ( string text, string repl, string with, int max ) : string
text string
repl string
with string
max int
return string

ReplaceChars() public static method

public static ReplaceChars ( string str, char searchChar, char replaceChar ) : string
str string
searchChar char
replaceChar char
return string

ReplaceChars() public static method

public static ReplaceChars ( string str, string searchChars, string replaceChars ) : string
str string
searchChars string
replaceChars string
return string

ReplaceOnce() public static method

public static ReplaceOnce ( string text, string repl, string with ) : string
text string
repl string
with string
return string

SafeToString() public static method

public static SafeToString ( object @object ) : string
@object object
return string

ToString() public static method

public static ToString ( byte bytes ) : string
bytes byte
return string