就像现在一样,我只添加一个小于0的附加项,并且我想再添加一个条件,如果用户输入的值不是数字,仍会显示相同的消息框。
['19.18.3.0/20 [110/128] via 19.18.2.2, 00:00:50, Serial1/1', '12.18.3.1/20 [110/128] via 19.18.2.2, 00:00:50, Serial1/1', '12.18.1.0/20 [110/128] via 19.18.2.2, 00:00:50, Serial0/1']
答案 0 :(得分:-1)
您可以执行以下操作:
String input = Console.ReadLine() //Or whatever you are using to catch the user input
int n;
if(int.TryParse(input, out n)
{
//Your logic, use n or something
}
else
{
//print error that there is no numeric input
}