List of utility methods to do String Split
String[] | getInputs(String str) get Inputs if (str == null) { return null; String[] splits = str.split(","); List<String> list = new ArrayList<String>(); for (String split : splits) { if (!split.trim().equals("")) { list.add(split); ... |
Object[] | getParameters(String[] split) get Parameters List<Object> p = new ArrayList<>(); for (int i = 1; i < split.length; i++) { String string = split[i]; int indexOf = string.indexOf("="); String paramName = string.substring(0, indexOf); String paramVal = string.substring(indexOf + 1); p.add(paramName); p.add(paramVal); ... |
String | getUsedInputs(String expression) get Used Inputs List<String> usedInputsList = new ArrayList<>(); Pattern pattern = Pattern.compile("\\w+"); Matcher matcher = pattern.matcher(expression); String currentString; while (matcher.find()) { currentString = matcher.group(); if (!usedInputsList.contains(currentString)) usedInputsList.add(currentString); ... |
List | recursiveSplit(String str, String splitor) recursive Split List<String> re = new ArrayList<String>(); String[] strs = twoPartSplit(str, splitor); if (strs.length == 2) { re.add(strs[0]); re.addAll(recursiveSplit(strs[1], splitor)); } else { re.add(strs[0]); return re; |
ArrayList | safeSplitParameters(String parameters) safe Split Parameters if (parameters == null || parameters.isEmpty()) return new ArrayList<String>(); ArrayList<String> ret = new ArrayList<String>(); int index = 0; do { int nextIndex = parameters.indexOf("&", index); if (nextIndex == -1) nextIndex = parameters.length(); ... |
List | split(byte[] bytes, byte[] p) Split bytes on pattern p. List<byte[]> result = new ArrayList<byte[]>(); byte[] tem = bytes; for (int index = index(tem, p); index != -1; index = index(tem, p)) { result.add(subBytes(tem, 0, index)); tem = subBytes(tem, index + p.length, tem.length - index - p.length); if (tem.length == 0) { break; if (tem.length > 0) { result.add(tem); return result; |
byte[][] | split(byte[] data) Splits a byte array by 0x00 ArrayList<Integer> offsets = new ArrayList<Integer>(); for (int i = 0; i < data.length; i++) { if (data[i] == 0x00) { offsets.add(i); offsets.add(data.length); byte[][] ret = new byte[offsets.size()][]; ... |
byte[][] | split(byte[] input) Spits the input array into separate byte arrays. ArrayList<byte[]> temp = new ArrayList<byte[]>(); byte[][] output; output = new byte[input.length][input.length]; int index_cache = 0; for (int i = 0; i < input.length; i++) { if (input[i] == 0x00) { byte[] b = subarray(input, index_cache, i - 1); temp.add(b); ... |
byte[][] | split(byte[] input) split ArrayList<byte[]> bytes = new ArrayList<byte[]>(); int index_cache = 0; for (int i = 0; i < input.length; i++) { if (input[i] == 0x00) { byte[] b = subarray(input, index_cache, i - 1); bytes.add(b); index_cache = i + 1; if (index_cache != 0) { byte[] b = subarray(input, index_cache, input.length - 1); bytes.add(b); byte[][] output = new byte[bytes.size()][input.length]; for (int i = 0; i < bytes.size(); i++) { output[i] = bytes.get(i); return output; |
List | split(final byte[] array, final int chunkSize) Splits an array into a list of arrays. if (array == null || array.length == 0) { return new ArrayList<byte[]>(0); } else { final int fullChunkCount = array.length / chunkSize; final int lastChunkSize = array.length % chunkSize; final List<byte[]> result = new ArrayList<byte[]>(fullChunkCount + (lastChunkSize > 0 ? 1 : 0)); for (int i = 0; i < fullChunkCount; i++) { final int from = i * chunkSize; ... |