If i have character string 'char name[30]' how to give validation for the name entered by user?
How to give validation for a character string in c++?
Collapse
X
-
Just compare the name that was entered to your validation criteria. So if the name needs to be capitalized, make sure name[0] is upper case, etc... -
The OP is using a char array and not a string class. Unless the OP asks for advice on programming techniques, don't provide an opinion.Comment
-
i think you're asking how to validate the content of name - if so, take a look at the isxxx functions, eg., isalpha, and friends. if you need something more complex, try regex().
do you have special requirements for the content of name[]?Comment
Comment