
1 risposta
String emailString = 'testemail@localhost..com';Boolean validemail = true;if(!emailString.contains('@')){ if(emailString.substringAfter('@').contain('localhost')) { validemail = false; } if(emailString.substringAfter('@').contain('..')) { validemail = false; } if(emailString.substringBefore('@').contain('..')) { validemail = false; }}else{ validemail = false;}if(!validemail ){addError}You need to use https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_string.htm to cover all your scenarios