Skip to content

String Operation

Split String

To split a string on a delimiter

String [] strArray =  string.split("<delimiter>");

Join String

To join the characters/string on a delimiter

String joinedString = String.join("<delimiter>",<list/array_of_string>);

Change case

To convert the string to lower case

string.toLowerCase();

to convert it to upper case

string.toUpperCase();

Substring

To create the sub-stirng

String subString = s.substring(startIndexInclusive,endIndexExclusive);

Repeat

To repeat the string

String repeatedString = s.repeat(times);

Comments