Michael Franz
asked on
Spliting Domain out from email address.
Hello,
I have the following email addresses:
michael.help@imlost.com
sahar.cool@insurance.com
I need to get the domain (ie. insurance.com) split off the right side because I need to write an if statement after this looking something like the following.
For example....
if(domain == null) ||(domain == "insurance.com")
{
"Employee"
}
else
{
"Other"
}
I have the following email addresses:
michael.help@imlost.com
sahar.cool@insurance.com
I need to get the domain (ie. insurance.com) split off the right side because I need to write an if statement after this looking something like the following.
For example....
if(domain == null) ||(domain == "insurance.com")
{
"Employee"
}
else
{
"Other"
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I'm getting an error....I cut the IF off for the time being...
String s="some.email@somedomain.c om";
int indexOfAt= s.indexOf('@');
String domain= s.substring(indexOfAt+1);
missing; before statement, line 28: String s=
String s="some.email@somedomain.c
int indexOfAt= s.indexOf('@');
String domain= s.substring(indexOfAt+1);
missing; before statement, line 28: String s=
ASKER
AWESOME!!!! Yea thank you. Easy and it works!
Open in new window