When you have in java  a string like “domain.com” and you want to split it to an array like this you have not to use the following

String domain=”domain.com”;
String domainsParts=domain.split(“.”);

but

String domainsParts=domain.split(“\\.”);

as the split(“.”) will not actually split the string because the “.” is reserved character when using regural expressions

 

 

By admin