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

ArrayListSplit(String Str, char splitchar)
??????
if (Str != null) {
    ArrayList ret = new ArrayList();
    StringBuffer tmpBuffer = new StringBuffer();
    for (int i = 0; i < Str.length(); i++) {
        if (Str.charAt(i) != splitchar)
            tmpBuffer.append(Str.charAt(i));
        else {
            ret.add(tmpBuffer.toString());
...
String[]split(String string, char c)
Splits the given string into its parts that are separated by the character c.
boolean instring = false;
ArrayList<String> list = new ArrayList<String>();
char[] cs = string.toCharArray();
StringBuilder buf = new StringBuilder();
int i = 0;
while (i < cs.length) {
    if (cs[i] == c && !instring) {
        list.add(buf.toString());
...
String[]split(String string, char character)
split
int index = string.indexOf(character);
if (index == -1) {
    return new String[] { string };
ArrayList split = new ArrayList();
while (index != -1) {
    split.add(string.substring(0, index));
    string = string.substring(index + 1);
...
String[]split(String toSplit, char splitChar, boolean trim)
Splits the given string into parts delimited by the given "split" character.
List tokens = new ArrayList();
StringBuffer token = new StringBuffer();
for (int i = 0; i < toSplit.length(); i++) {
    if (toSplit.charAt(i) == splitChar) {
        if (trim) {
            tokens.add(token.toString().trim());
        } else {
            tokens.add(token.toString());
...
String[]split(String val, char ch)
Splits string with given character.
int offset = 0;
ArrayList<String> list = new ArrayList<>();
int nextPos = val.indexOf(ch, offset);
while (nextPos != -1) {
    list.add(val.substring(offset, nextPos));
    offset = nextPos + 1;
    nextPos = val.indexOf(ch, offset);
if (offset == 0) {
    return new String[] { val };
list.add(val.substring(offset, val.length()));
return list.toArray(new String[list.size()]);
String[]split(String value, char splitChar)
split strings by the character.
ArrayList<String> result = new ArrayList<String>();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < value.length(); i++) {
    char ch = value.charAt(i);
    if (ch == splitChar) {
        result.add(sb.toString());
        sb.setLength(0);
    } else {
...
String[]splitAt(String inputString, Character inputChar)
split At
ArrayList<String> stringList = new ArrayList<String>();
String tempString; 
StringBuilder sb = new StringBuilder();
for (int i = 0; i < inputString.length(); i++) {
    if (inputString.charAt(i) != inputChar) {
        sb.append(inputString.charAt(i));
    else {
...
String[]splitAt(String str, char c)
split At
int index = str.indexOf(c);
ArrayList<String> split = new ArrayList<String>();
while (index != -1) {
    split.add(str.substring(0, index));
    str = str.substring(index + 1);
    index = str.indexOf(c);
split.add(str);
...
ListsplitByChar(final String message, final char ch)
split string at each occurrence of a character (e.g.
List<String> lines = new ArrayList<>();
int index = 0;
int nextIndex;
while ((nextIndex = message.indexOf(ch, index)) != -1) {
    lines.add(message.substring(index, nextIndex));
    index = nextIndex + 1;
lines.add(message.substring(index));
...
String[]splitByNonNestedChars(String s, char... c)
Splits string s by any chars c for every occurrence of chars c that are not nested in parentheses.
int parDepth = 0;
String chars = new String(c);
ArrayList<String> parts = new ArrayList<String>();
for (int i = 0; i < s.length(); i++) {
    if (s.charAt(i) == '(')
        parDepth++;
    else if (s.charAt(i) == ')')
        parDepth--;
...