+ 1
How do I make a code in CS identify if the user input had letters or numbers?
2 Antworten
+ 3
The Char-type has lots of methods that will tell you if a particular char is a number or a character.
try
Char.IsNumber(your char)
Char.IsLetter(your char)
So loop through the user-input, get single chars and check with these functions
https://docs.microsoft.com/en-us/dotnet/api/system.char.isletter?view=netframework-4.8
https://docs.microsoft.com/en-us/dotnet/api/system.char.isnumber?view=netframework-4.8
https://www.geeksforgeeks.org/c-sharp-char-isdigit-method/
+ 2
I think , easiest way it look ASCII table, get HEX codes for chars and numbers, and then write if-else comparator.