MCPcopy Index your code
hub / github.com/BruceEckel/OnJava8-Examples / examine

Method examine

strings/StartEnd.java:27–40  ·  view source on GitHub ↗
(String s, String regex)

Source from the content-addressed store, hash-verified

25 }
26 }
27 static void examine(String s, String regex) {
28 Display d = new Display(regex);
29 Pattern p = Pattern.compile(regex);
30 Matcher m = p.matcher(s);
31 while(m.find())
32 d.display("find() '" + m.group() +
33 "' start = "+ m.start() + " end = " + m.end());
34 if(m.lookingAt()) // No reset() necessary
35 d.display("lookingAt() start = "
36 + m.start() + " end = " + m.end());
37 if(m.matches()) // No reset() necessary
38 d.display("matches() start = "
39 + m.start() + " end = " + m.end());
40 }
41 public static void main(String[] args) {
42 for(String in : input.split("\n")) {
43 System.out.println("input : " + in);

Callers 1

mainMethod · 0.95

Calls 3

displayMethod · 0.95
endMethod · 0.65
startMethod · 0.45

Tested by

no test coverage detected