MCPcopy Create free account
hub / github.com/crate/crate / split

Method split

server/src/main/java/org/elasticsearch/common/Strings.java:311–322  ·  view source on GitHub ↗

Split a String at the first occurrence of the delimiter. Does not include the delimiter in the result. @param toSplit the string to split @param delimiter to split the string up with @return a two element array with index 0 being before the delimiter, and index 1 being after the delimiter

(String toSplit, String delimiter)

Source from the content-addressed store, hash-verified

309 * or <code>null</code> if the delimiter wasn't found in the given input String
310 */
311 public static String[] split(String toSplit, String delimiter) {
312 if (!hasLength(toSplit) || !hasLength(delimiter)) {
313 return null;
314 }
315 int offset = toSplit.indexOf(delimiter);
316 if (offset < 0) {
317 return null;
318 }
319 String beforeDelimiter = toSplit.substring(0, offset);
320 String afterDelimiter = toSplit.substring(offset + delimiter.length());
321 return new String[]{beforeDelimiter, afterDelimiter};
322 }
323
324 /**
325 * Tokenize the given String into a String array via a StringTokenizer.

Callers 15

TaskIdMethod · 0.95
killFunction · 0.45
handleMethod · 0.45
QueryCmdMethod · 0.45
formatExpectedRowsMethod · 0.45
hasOperatorsMethod · 0.45
hasLinesMethod · 0.45
refInfoMethod · 0.45
getTestAnnotationMethod · 0.45

Calls 4

hasLengthMethod · 0.95
substringMethod · 0.80
indexOfMethod · 0.65
lengthMethod · 0.65

Tested by 15

handleMethod · 0.36
QueryCmdMethod · 0.36
formatExpectedRowsMethod · 0.36
hasOperatorsMethod · 0.36
hasLinesMethod · 0.36
refInfoMethod · 0.36
getTestAnnotationMethod · 0.36
test_explain_insertMethod · 0.36
assertSettingsValueMethod · 0.36