D
D
dearname2014-05-28 18:47:42
C++ / C#
dearname, 2014-05-28 18:47:42

How to check for numbers and other specials. operations?

How to check for char in pluses to determine what kind of character. For example, if the character type is a digit, how do I know if it's a digit or a letter? This is necessary for the drug analyzer.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
EndUser, 2014-05-28
@EndUser

en.cppreference.com/w/c/string/byte/isdigit
en.cppreference.com/w/cpp/string/byte/isdigit

J
jcmvbkbc, 2014-05-28
@jcmvbkbc

For example, if the character type is a digit, how do I know if it's a digit or a letter?

Try to learn how to ask questions in such a way that the people you ask them can understand them, preferably unambiguously. This will help both you and those you ask.
Characters are bytes, they can be simply compared. For example
if (c == '1')
if (c >= 'a' && c <= 'z')
In addition, there is a family of is* classifier functions declared in <ctype.h>/<cctype> . They classify characters based on the current locale.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question