- When we want to print a array , We can use this way
System.out.println( Arrays.toString( text .split("a") ) );
The string you give
split
defines a regular expression, so any characters special in regular expressions have to be escaped:
String[] parts = string.split("\\$@");
- When we want to convert List <String> stringListValues , to string value . We can use following way
- When we have string values set such as String names = "Saman , Kumara , Ramanayaka " ; and we want
String[] nameArray = names.split( " , " );
- String newStringValue = String.join( "-> ", "Wake up", "Eat", "Play", "Sleep", "Wake up" );
Output will be : Wake up-> Eat-> Play-> Sleep-> Wake up
- To reverse a string
String stringObj= "Hiiiiii Kamlal";
StringBuffer stringBufferObj = new StringBuffer( stringObj );
stringBufferObj.reverse();
Version : - 1.1.0
No comments:
Post a Comment