In JAVA we can split a String with Dot "." using a split() function. But it can be done in a different way as compared to other characters. Dot "." is a reserved character in regular expression, hence it will not treat the split on dot the same way.
Following code can be used to split a string by dot.
String stringWithDot = "rizzz86.blogspot.com"; String[] stringArray = stringWithDot.split("\\.");
Double backslash will do the work where one slash is work as a escape character.
rizzz86
No comments:
Post a Comment