A
A
Amigo20192020-11-12 01:13:13
Java
Amigo2019, 2020-11-12 01:13:13

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

1 answer(s)
O
Orkhan, 2020-11-12
Hasanly @azerphoenix

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 question

Ask a Question

731 491 924 answers to any question