(String str, int start)
| 1492 | } |
| 1493 | |
| 1494 | public int indexOfIgnoreCase (String str, int start) { |
| 1495 | if (start < 0) start = 0; |
| 1496 | int length = str.length(); |
| 1497 | if (length == 0) return start < size || start == 0 ? start : size; |
| 1498 | int maxIndex = size - length; |
| 1499 | if (start > maxIndex) return -1; |
| 1500 | char firstUpper = Character.toUpperCase(str.charAt(0)); |
| 1501 | char firstLower = Character.toLowerCase(firstUpper); |
| 1502 | while (true) { |
| 1503 | int i = start; |
| 1504 | boolean found = false; |
| 1505 | for (; i <= maxIndex; i++) { |
| 1506 | char c = items[i]; |
| 1507 | if (c == firstUpper || c == firstLower) { |
| 1508 | found = true; |
| 1509 | break; |
| 1510 | } |
| 1511 | } |
| 1512 | if (!found) return -1; |
| 1513 | int o1 = i, o2 = 0; |
| 1514 | while (++o2 < length) { |
| 1515 | char c = items[++o1]; |
| 1516 | char upper = Character.toUpperCase(str.charAt(o2)); |
| 1517 | if (c != upper && c != Character.toLowerCase(upper)) break; |
| 1518 | } |
| 1519 | if (o2 == length) return i; |
| 1520 | start = i + 1; |
| 1521 | } |
| 1522 | } |
| 1523 | |
| 1524 | /** Inserts the value into this CharArray. |
| 1525 | * @throws IndexOutOfBoundsException if the index is invalid */ |
no test coverage detected