(Object str2, Object idx1, Object idx2)
| 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; |
no test coverage detected