MCPcopy Index your code
hub / github.com/ccxt/ccxt / Slice

Method Slice

java/lib/src/main/java/io/github/ccxt/Helpers.java:786–809  ·  view source on GitHub ↗
(Object str2, Object idx1, Object idx2)

Source from the content-addressed store, hash-verified

784 // public String slice(Object str2, Object idx1, Object idx2) { return Slice(str2, idx1, idx2); }
785
786 public static String Slice(Object str2, Object idx1, Object idx2) {
787 if (str2 == null) return null;
788 String str = (String) str2;
789 int start = (idx1 != null) ? toInt(idx1) : -1;
790
791 if (idx2 == null) {
792 if (start < 0) {
793 int innerStart = str.length() + start;
794 innerStart = Math.max(innerStart, 0);
795 return str.substring(innerStart);
796 } else {
797 if (start > str.length()) return "";
798 return str.substring(start);
799 }
800 } else {
801 int end = toInt(idx2);
802 if (start < 0) start = str.length() + start;
803 if (end < 0) end = str.length() + end;
804 if (start < 0) start = 0;
805 if (end > str.length()) end = str.length();
806 if (start > end) start = end;
807 return str.substring(start, end);
808 }
809 }
810
811 public static Object concat(Object a, Object b) {
812 if (a == null && b == null) return null;

Callers 15

sliceMethod · 0.95
SliceFunction · 0.80
ArraySliceMethod · 0.80
SortMethod · 0.80
SortByMethod · 0.80
SortBy2Method · 0.80

Calls 3

toIntMethod · 0.95
lengthMethod · 0.45
maxMethod · 0.45

Tested by

no test coverage detected