字符串替换问题
下面的这个方法是想检测输入的是不是数字,调用后通过MessageBox发现没有替换掉,应该怎么样写替换语句呢?
private bool check_number(string text_tobecheck)
{
text_tobecheck.Replace("1","");
text_tobecheck.Replace("2","");
text_tobecheck.Replace("3","");
text_tobecheck.Replace("4","");
text_tobecheck.Replace("5","");
text_tobecheck.Replace("6","");
text_tobecheck.Replace("7","");
text_tobecheck.Replace("8","");
text_tobecheck.Replace("9","");
text_tobecheck.Replace("0","");
text_tobecheck.Replace(".","");
MessageBox.Show(text_tobecheck);
if(text_tobecheck=="")
{
return true;
}
else
{
return false;
}
}