Find a key in a String (words merely ending with 'key' don't qualify). @return index of first character after the key, or -1 if not found
(String s, String key)
| 1614 | * @return index of first character after the key, or -1 if not found |
| 1615 | */ |
| 1616 | private int findKey(String s, String key) { |
| 1617 | int i = s.indexOf(key); |
| 1618 | if (i<0) |
| 1619 | return -1; //key not found |
| 1620 | while (i>0 && Character.isLetterOrDigit(s.charAt(i-1))) |
| 1621 | i = s.indexOf(key, i+key.length()); |
| 1622 | if (i>=0) |
| 1623 | return i + key.length(); |
| 1624 | else |
| 1625 | return -1; |
| 1626 | } |
| 1627 | |
| 1628 | /** Adds a key-value pair to this image's string properties. |
| 1629 | * The key-value pair is removed if 'value' is null. The |
no test coverage detected