public class textualEdit
{
public string str = " "; //存储一页文章
public string s; // 统计在文章中要查的重复的字符串
public string st; // 要删除的字符串
public int count(string str) //统计文章总字数
{
this.str = str;
int Count = 0;
Count = str.Length;
return Count;
}
public int blankSpace(string str) //统计在文章中出现空格个数
{
this.str = str;
string Del = str.Replace(" ", "");
return str.Length - Del.Length;
}
public int repeat(string str, string s) //统计某个字符串在文章中出现的次数
{
int count3 = str.Length;
string dstr = Dele(str, s);
return (count3 - dstr.Length) / s.Length;
}
public int amount(string str) //统计在文章中出现数字个数
{
this.str = str;
char[] cara = str.ToCharArray();
var ch1 = Array.FindAll(cara, x => char.IsDigit(x));
return ch1.Length;
}
public string Dele(string str, string st) //文章中要删除的某一子串
{
this.str = str;
this.st = st;
string Del = str.Replace(st, "");
return Del;
}
}
{
public string str = " "; //存储一页文章
public string s; // 统计在文章中要查的重复的字符串
public string st; // 要删除的字符串
public int count(string str) //统计文章总字数
{
this.str = str;
int Count = 0;
Count = str.Length;
return Count;
}
public int blankSpace(string str) //统计在文章中出现空格个数
{
this.str = str;
string Del = str.Replace(" ", "");
return str.Length - Del.Length;
}
public int repeat(string str, string s) //统计某个字符串在文章中出现的次数
{
int count3 = str.Length;
string dstr = Dele(str, s);
return (count3 - dstr.Length) / s.Length;
}
public int amount(string str) //统计在文章中出现数字个数
{
this.str = str;
char[] cara = str.ToCharArray();
var ch1 = Array.FindAll(cara, x => char.IsDigit(x));
return ch1.Length;
}
public string Dele(string str, string st) //文章中要删除的某一子串
{
this.str = str;
this.st = st;
string Del = str.Replace(st, "");
return Del;
}
}