lundi 30 janvier 2017

Check string for a character loop

I need to validate user input string to make sure it contains a comma. If it does not contain a comma it must print "Error" and allow for the user to re-enter input. I'm just not sure which loop to use. If else may work, but I need it to loop back to the scanner for the user input. Or a while loop that uses .contains? Thanks.

Aucun commentaire:

Enregistrer un commentaire