public static bool IfHankaku(string CheckInput)
{
//单字符
int sum = 0;
for (int i = 0; i < CheckInput.Length; i++)
{
if(CheckInput[i]=='.')
{
sum = sum + 1;
}
if (sum > 1)
{
return true;
}
}
return false;
}
string str1=textBox1.Text;
string sub1=str1.Replace(".","");
if(str1.Length-sub1.Length>1)
{
textBox1.Text = "0.000";
return;
}
以上二例都是判断字符串中重复字符的算法