validate that an email address contains “@” and “.”
问题 i need to validate that an inserted email address contains "@" and "." without a regular expression. Can somebody to give me "java code" and "structure chart" examples please? 回答1: I suspect you're after something like: if (!address.contains("@") || !address.contains(".")) { // Handle bad address } EDIT: This is far from a complete validation, of course. It's barely even the start of validation - but hopefully this will get you going with the particular case you wanted to handle. 回答2: You can