But most of beginners don't know we can pass regular expression as a delimiter.
Here I am using a regular expression as a delimiter to split the String by any white space regardless it is a tab, space, multiple tabs or spaces.
str = "This is the String with different white spaces"; String[] splited = str.split("\\s+");
No comments:
Post a Comment