Skip to content

Conversation

marcosonmachine
Copy link

Removed redundant digit check loop, optimizing phone number validation.

Removed redundant digit check loop, optimizing phone number validation.
Copy link
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KalleOlaviNiemitalo
Copy link

The loop isn't redundant anyway. The first loop verifies that the phone number has at least one digit. The second loop verifies that the phone number contains only digits and some other allowed characters. So if you deleted the first loop, then the method would also accept e.g. () as a phone number. This does not contain any digits and should be rejected.

@marcosonmachine
Copy link
Author

The loop isn't redundant anyway. The first loop verifies that the phone number has at least one digit. The second loop verifies that the phone number contains only digits and some other allowed characters. So if you deleted the first loop, then the method would also accept e.g. () as a phone number. This does not contain any digits and should be rejected.

Yes, you are right. This is from last year, sorry I forgot to close it.

Again I am sorry for it caused inconvenience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants