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?
1 Réponse
+ 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()