jeudi 5 mars 2015

Find a character or group of characters in a string and remove them



I am trying to build a program that will locate the '@' symbol, then the .edu part of a educational email address, finally remove the "@school.edu" section, and return the rest. I tried using charAt, but I keep receiving an incompatible types error, and I'm nit sure how to remove a section of a string that could be in a different location each time. Thanks!


here is what I have so far:



if (UserEmail.charAt(0) == (".edu"))
String UserName = UserEmail.substring(0,//location of @//)

else
System.out.print(UserEmail + "is not an acceptable email address.
System.out.print("Type your email address.");
UserEmail = kb.nextLine();



Aucun commentaire:

Enregistrer un commentaire