List of utility methods to do String Split by Case
ArrayList | split(String pString, String pSeparator, boolean pIgnoreCase) split ArrayList lSplit = new ArrayList(); int lIndex = 0; int lSeparator; String lSubString; String pCompStr; String pCompSep; if (pIgnoreCase) { pCompStr = (pString == null) ? null : pString.toLowerCase(); ... |
String[] | splitByCamelCase(String name) split By Camel Case List<String> parts = new ArrayList<String>(); StringBuilder b = new StringBuilder(); for (int i = 0; i < name.length(); i++) { if (i > 0 && Character.isUpperCase(name.charAt(i))) { parts.add(b.toString()); b = new StringBuilder(); b.append(Character.toLowerCase(name.charAt(i))); ... |
List | splitByCharacterTypeCamelCase(String targetName) split By Character Type Camel Case List<String> wordsList = new ArrayList<String>(); StringBuilder word = new StringBuilder(); for (int i = 0; i < targetName.length(); i++) { char c = targetName.charAt(i); if (Character.isUpperCase(c) && i > 0) { wordsList.add(word.toString()); word.delete(0, word.length()); word.append(Character.toLowerCase(c)); ... |
List | splitCamelCase(final String in) Splits camel case. List<String> result = new ArrayList<String>(); char[] chars = in.toCharArray(); int takenLength = 0; boolean lastLower = false; boolean nextLower = isNextLower(chars, -1); boolean lastNeutral = false; boolean currentNeutral = false; for (int i = 0; i < chars.length; ++i) { ... |
String[] | splitCamelCase(final String s) Splits a camel case string into individual words. final ArrayList<String> words = new ArrayList<String>(); final int length = s.length(); int i = 0; final StringBuilder sb = new StringBuilder(); while (i < length) { while (i < length && Character.isUpperCase(s.charAt(i))) { sb.append(s.charAt(i)); ++i; ... |
List | splitCamelCase(String src) split Camel Case List<String> tokens = new ArrayList<>(); int wordStart = 0; char c = src.charAt(0); int capsCount = Character.isUpperCase(c) ? 1 : 0; for (int i = 1; i < src.length(); ++i) { c = src.charAt(i); if (Character.isUpperCase(c)) { switch (capsCount) { ... |
String[] | splitCamelCase(String string) split Camel Case List<String> nodes = new ArrayList<String>(); char[] chars = string.toCharArray(); StringBuilder buff = new StringBuilder(); for (int i = 0; i < chars.length; i++) { char c = chars[i]; if (Character.isUpperCase(c)) { nodes.add(buff.toString()); buff.delete(0, buff.length()); ... |
String[] | splitOnUppercase(String input) split On Uppercase StringBuilder part = new StringBuilder(); List<String> parts = new ArrayList<String>(); for (char c : input.toCharArray()) { if (Character.isUpperCase(c)) { if (part.length() > 0) parts.add(part.toString()); part.setLength(0); part.append(c); if (part.length() > 0) parts.add(part.toString()); return parts.toArray(new String[parts.size()]); |
ArrayList | splitString(String string, Character character, boolean encased) Splits the string wherever character is found. ArrayList<String> arrayList = new ArrayList<String>(); string += character; int start = 0; int end = string.indexOf(character); if (end == 0) end = string.indexOf(character, 1); if (end == -1) { arrayList.add(string); ... |
List | splitWords(String text, boolean toLowerCase) split Words List<String> words = new ArrayList<String>(); StringBuilder word = new StringBuilder(); for (int i = 0; i < text.length(); i++) { if (Character.isAlphabetic(text.charAt(i))) { word.append(toLowerCase ? Character.toLowerCase(text.charAt(i)) : text.charAt(i)); continue; if (!word.toString().isEmpty()) { ... |