MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / findKey

Method findKey

ij/src/main/java/ij/ImagePlus.java:1616–1626  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 1

getStringPropertyMethod · 0.95

Calls 3

charAtMethod · 0.80
lengthMethod · 0.65
indexOfMethod · 0.45

Tested by

no test coverage detected