Answer the question
In order to leave comments, you need to log in
How to check without a regular expression that a character is among the allowed ones?
Good afternoon!
How to check without a regular expression that a character is among the allowed ones?
There is an array of allowed characters (very different) and it is necessary that if the entered character is not equal to one of the allowed ones (located in the array), then there was an exit from the loop indicating this non-owned character.
I tried but somehow it doesn’t work out that way, I missed something ..
I would be glad for any help.
Thank you
So far it turned out like this, but somehow it does not work correctly
Answer the question
In order to leave comments, you need to log in
Without a regular expression, you can do this:
create a method. which will take a char as an argument
, iterate over the char array of characters.
In each iteration, check whether the characters are ranvy or not.
If there is no match, return false otherwise true
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question