Here you can find the source of stringSplit(String s)
public static String[] stringSplit(String s)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; public class Main { public static String[] stringSplit(String s) { List<String> f = new ArrayList<>(); int p = 0; for (int i = 0; i < s.length(); i++) { if (s.charAt(i) == ' ') { f.add(s.substring(p, i)); p = i + 1;/* ww w. j a v a 2 s . c om*/ while (i < s.length() - 1 && s.charAt(i + 1) == ' ') { i++; p++; } } else if (s.charAt(i) == '`') { if (s.substring(i, Math.min(i + 3, s.length())).equals("```")) { int start = i + 3; i += 3; while (i < s.length() - 3 && !s.substring(i, Math.min(i + 3, s.length())).equals("```")) { i++; } if (s.substring(i, Math.min(i + 3, s.length())).equals("```")) { int end = i; f.add(s.substring(start, end)); i += 3; p = i; } else { // unterminated f.add(s.substring(start, i)); } } } else if (s.charAt(i) == '\n' || s.charAt(i) == '\r' && s.charAt(i + 1) == '\n') { f.add(s.substring(p, i + 1)); p = i + 1; } } f.add(s.substring(p)); return f.toArray(new String[f.size()]); } }