C# Class ElizaCore.EString

Eliza string functions.
Eliza string functions.
显示文件 Open project: xamarin/monotouch-samples Class Usage Examples

Public Methods

Method Description
Amatch ( string str, string pat ) : int

Look for a match between the string and the pattern.

Look for a match between the string and the pattern. Return count of maching characters before * or #. Return -1 if strings do not match.

Compress ( string s ) : string

Compresses its input by: dropping space before space, comma, and period; adding space before question, if char before is not a space; and copying all others

Count ( string s, char c ) : int

Count number of occurrances of c in str

FindNum ( string str ) : int

Look for a number in the string.

Look for a number in the string. Return the number of digits at the beginning.

FindPat ( string str, string pat ) : int

Search in successive positions of the string, looking for a match to the pattern.

Search in successive positions of the string, looking for a match to the pattern. Return the string position in str of the match, or -1 for no match.

Match ( string str, string pat, string matches ) : bool
Pad ( string s ) : string

Pad by ensuring there are spaces before and after the sentence.

Pad by ensuring there are spaces before and after the sentence.

Translate ( string str, string src, string dest ) : string
Trim ( string s ) : string

Trim off leading space

Private Methods

Method Description
MatchA ( string str, string pat, string matches ) : bool

Match the string against a pattern and fills in matches array with the pieces that matched * and #

MatchB ( string strIn, string patIn, string matches ) : bool

Method Details

Amatch() public static method

Look for a match between the string and the pattern.
Look for a match between the string and the pattern. Return count of maching characters before * or #. Return -1 if strings do not match.
public static Amatch ( string str, string pat ) : int
str string
pat string
return int

Compress() public static method

Compresses its input by: dropping space before space, comma, and period; adding space before question, if char before is not a space; and copying all others
public static Compress ( string s ) : string
s string
return string

Count() public static method

Count number of occurrances of c in str
public static Count ( string s, char c ) : int
s string
c char
return int

FindNum() public static method

Look for a number in the string.
Look for a number in the string. Return the number of digits at the beginning.
public static FindNum ( string str ) : int
str string
return int

FindPat() public static method

Search in successive positions of the string, looking for a match to the pattern.
Search in successive positions of the string, looking for a match to the pattern. Return the string position in str of the match, or -1 for no match.
public static FindPat ( string str, string pat ) : int
str string
pat string
return int

Match() public static method

public static Match ( string str, string pat, string matches ) : bool
str string
pat string
matches string
return bool

Pad() public static method

Pad by ensuring there are spaces before and after the sentence.
Pad by ensuring there are spaces before and after the sentence.
public static Pad ( string s ) : string
s string
return string

Translate() public static method

public static Translate ( string str, string src, string dest ) : string
str string
src string
dest string
return string

Trim() public static method

Trim off leading space
public static Trim ( string s ) : string
s string
return string