比如
string n = Console.ReadLine();
if(?)
{
//执行数字的程序
}
else
{
//执行字符串的程序
}
string n = Console.ReadLine();
if(?)
{
//执行数字的程序
}
else
{
//执行字符串的程序
}
解决方案 »
- 谁知道如何把VS2005的任务列表弄出来?
- 如何有效学习系统的类库
- IsNiuRen(word里面光标处可以被识别为:Application.Selection.Range,那么没有插光标的情况下呢?);
- Web项目中,当前不会命中断点,还没有为该文档加载任何符号
- 动态取消事件
- 用C#编写的记事本编辑菜单下的删除功能怎么实现
- 如何让文本框里的特定的字的颜色和其它的字不一样
- System.Security.Cryptography.CryptographicException拒绝访问!!
- 看看这段代码,大家帮帮我
- SQL SERVER 与 Datatable 的问题
- C语言中的算法转换到C#,什么得出的结果会出现不同?
- 求高手帮我看看 这两个正则改怎么写?
int num;
if (int.TryParse(n, out num))
{
// num 就是结果数字
//执行数字的程序
}
else
{
//执行字符串的程序
}
Char.IsLetter()
{
return Regex.IsMatch(value, @"^[+-]?\d*[.]?\d*$");
}
tring n = Console.ReadLine();
int num;
if (IsNumeric(n))
{
//执行数字的程序
}
else
{
//执行字符串的程序
}
{
Regex regex = new Regex("^[0-9]*$");
return regex.IsMatch(validateString.Trim());
}
string n = Console.ReadLine();
bool isNum=RegexValidate(s);
if(bool ){}else{]
bool isNum = false;
double num = 0;
try
{
num = double.Parse(n);
isNum = true;
}
catch
{}
if(isNum)
{
// do somthing with num
}
else
{
// do something with n
}
{
return Regex.IsMatch(value, @"^[+-]?\d*[.]?\d*$");
}
这是什么意思?