static void Main()
{
string str;
str = Console.ReadLine();
while (str != null)
{
str = str.Remove(0, 1);
str = str.Remove(str.Length - 1, 1);
string[] value = str.Split(',');
int[] intval = new int[value.Length];
for (int i = 0; i < value.Length; ++i)
{
bool re = int.TryParse(value[i], out intval[i]);
Console.WriteLine(intval[i]);
}
str = Console.ReadLine();
}
}
Hi, in the above program, I want to judge if there is material that cannot be read in the console using "str! = Null".
However, ReadLine () returned me "" instead of zero, and the program may fall into the while loop and create the wrong result.
How can i fix this?
source
share