The list of methods to do String Split by Space are organized into topic(s).
String[]
splitAndKeepEscapedSpaces(String string, boolean preserveEscapes) split And Keep Escaped Spaces
Collection<String> result = new ArrayList<String>();
StringBuilder current = new StringBuilder();
for (int i = 0; i < string.length(); i++) {
char ch = string.charAt(i);
if (ch == ' ') {
boolean isGluedSpace = i > 0 && string.charAt(i - 1) == '\\';
if (!isGluedSpace) {
result.add(current.toString());
...
String[]
splitAtSpaces(String s) Splits a string separated by space characters.
if (s == null || s.length() == 0)
return emptyStringArray;
int index = 0;
int sLength = s.length();
while (index < sLength) {
char c = s.charAt(index);
if (c != 0x09 && c != 0x0a && c != 0x0c && c != 0x0d && c != 0x20) {
break;
...
String[]
splitBySpace(String p_str) split By Space
if (p_str == null || p_str.trim().equals(""))
return new String[] { p_str };
ArrayList<String> list = new ArrayList<String>();
String[] tmp = p_str.split(" ");
for (String t : tmp) {
if ("".equals(t.trim()))
continue;
list.add(t);
...
List
splitInWhiteSpaces(String string)
Splits the given string in a list where each element is a line.
ArrayList<String> ret = new ArrayList<String>();
int len = string.length();
int last = 0;
char c = 0;
for (int i = 0; i < len; i++) {
c = string.charAt(i);
if (Character.isWhitespace(c)) {
if (last != i) {
...
String[]
splitNamespaceTitle(String fullTitle) split Namespace Title
String[] fields = new String[2];
fields[0] = "";
fields[1] = fullTitle;
int i = fullTitle.indexOf(":");
if (i > 0) {
String namespace = fullTitle.substring(0, i);
Integer ns = NAMESPACE_MAP.get(namespace);
if (ns != null) {
...
List
splitOnSpace(final String string)
Splits the given string on spaces, which is faster than String.split(...) for this special case.
final List<String> words = new ArrayList<>();
final int string_len = string.length();
int index = 0;
for (int i = 0; i < string_len; i++) {
final char ch = string.charAt(i);
if (ch == ' ') {
if (i > index) {
words.add(string.substring(index, i));
...
String[]
splitOnSpace(String string) split On Space
int index = string.indexOf(' ');
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[]
SplitOnWhitespace(String instrData) Split On Whitespace
String[] astrData = instrData.split("\\s+");
ArrayList<String> llOutput = new ArrayList<String>();
for (int i = 0; i < astrData.length; ++i) {
if (astrData[i] != null && astrData[i].length() != 0) {
llOutput.add(astrData[i]);
String[] astrOutput = new String[llOutput.size()];
...
List
splitSpaces(String input)
Method to split a string using spaces ("/\\s+/" regex).
List<String> results = new ArrayList<String>();
String parts[] = input.split("\\s+");
for (int i = 0; i < parts.length; i++) {
if (parts[i].length() > 0) {
results.add(parts[i]);
return results;
...