Java Utililty Methods String Split by Char

List of utility methods to do String Split by Char

Description

The list of methods to do String Split by Char are organized into topic(s).

Method

Listsplit(String str, char c)
split
List<String> results = new ArrayList<String>();
for (int i = 0; i < str.length();) {
    StringBuilder sb = new StringBuilder();
    for (int j = i; j < str.length(); j++) {
        char tmp = str.charAt(j);
        if (j == str.length() - 1) {
            sb.append(tmp);
            results.add(sb.toString());
...
String[]split(String str, char c)
split
str += c;
int n = 0;
for (int i = 0; i < str.length(); i++) {
    if (str.charAt(i) == c) {
        n++;
String out[] = new String[n];
...
String[]split(String str, char ch)
split
ArrayList list = null;
int ix = 0;
int len = str.length();
for (int i = 0; i < len; ++i) {
    char c = str.charAt(i);
    if (c == ch) {
        if (list == null) {
            list = new ArrayList();
...
String[]split(String str, char ch)
split.
List<String> list = null;
char c;
int ix = 0, len = str.length();
for (int i = 0; i < len; i++) {
    c = str.charAt(i);
    if (c == ch) {
        if (list == null)
            list = new ArrayList<String>();
...
String[]split(String str, char ch, int size)
Splits the specified string around matches of the given delimiting char.
String[] a = new String[size];
int j = str.indexOf(ch), k = 0, i = 0;
while (j != -1) {
    a[i++] = str.substring(k, j);
    str = str.substring(j + 1, str.length());
    j = str.indexOf(ch);
a[i++] = str.substring(j + 1, str.length());
...
Listsplit(String str, char cha)
split
System.out.println(str + ":" + cha);
List<String> list = new ArrayList<String>();
StringBuffer sbf = new StringBuffer(str);
StringBuffer newSbf = new StringBuffer("");
for (int i = 0; i < sbf.length(); i++) {
    char c = sbf.charAt(i);
    if (c == cha) {
        list.add(newSbf.toString());
...
String[]split(String str, char deli)

Description:split a string into String array delimited by character

if ((str == null) || "".equals(str)) {
    return new String[0];
ArrayList<String> parts = new ArrayList<String>();
int currIdx;
int prevIdx = 0;
while ((currIdx = str.indexOf(deli, prevIdx)) > 0) {
    String part = str.substring(prevIdx, currIdx).trim();
...
String[]split(String str, char sep)
split
if (str == null) {
    return new String[0];
int length = str.length();
char ch = 0;
List<String> strList = new ArrayList<String>();
StringBuilder strBuilder = new StringBuilder();
for (int i = 0; i < length; i++) {
...
String[]split(String str, char splitChar)
Parse a string into a series of string tokens using the specified delimiter.
if (str == null) {
    return null;
if (str.trim().equals("")) {
    return new String[0];
if (str.indexOf(splitChar) == -1) {
    String[] strArray = new String[1];
...
String[]split(String str, char splitChar)
split
ArrayList al = new ArrayList(8);
int i = -1;
String s;
String rest = str;
while ((i = rest.indexOf(splitChar)) != -1) {
    s = rest.substring(0, i);
    al.add(s);
    rest = rest.substring(i + 1);
...