Checking each value of a console output

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Checking each value of a console output



I would like to read each value one by one, every single one they keep typing until they press a value which ends the "input checking".



I have checked several other posts but none works for me, because I don't want to use arrays or lists, the value must be checked once, and if that happens then work with that.



I have managed to achieve this:


char END = '#', value;
bool found= false;
int count = 0;

Console.WriteLine("Write a line ending in '#'.");
value = Convert.ToChar(Console.Read());
if (value == END)
found = true;

while (!found)

count++;
value = Convert.ToChar(Console.Read());
if (value == END)
found = true;

}
Console.WriteLine("You have typed " + count);





Waht do you mean by "value of a console input"? Do you want read string by string or char by char?
– Dmitry Bychenko
3 mins ago





I changed to output. Thanks @DmitryBychenko. I want to read char by char, or in another case, int by int
– Raül
1 min ago









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard