Condition to check number of digits typed in java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Condition to check number of digits typed in java?

Please is there any condition that can check user input for a number of digits type. For example: With a mobile money service, if a user Input a number less or more than number of digits. ie 10 digits, there is a command prompt thrown to the user. Any help family?

31st Mar 2022, 12:26 PM
RAPHEAL KUMA
RAPHEAL KUMA - avatar
1 Answer
+ 1
just count the length of the user input string in java, stringName.length() in js, string.length or store the input in an array or string, and use a loop or string input = "abcde"; in c++ use input.length()
31st Mar 2022, 12:28 PM
NonStop CODING
NonStop CODING - avatar