/** * Walks forward with the caret until it points at a position which matches the given string. * Then advances the position after this string. Case-Sensitive comparison is used. * * @param strToMatch * the string to match * @return true if the string was found, false if the end of the string was reached while * searching */ public boolean walkAfterMatchCheckCase(String strToMatch) { boolean found = walkToMatchCheckCase(strToMatch); if (found) { offset += strToMatch.length(); } return found; }
@Test public void test() { String test = " ABCDEFGH\t\r\nabcdefgh"; Caret c = new Caret(test, 0); assertThat(c.walkToMatchCheckCase("cdefg"), equalTo(true)); assertThat(c.get(0), equalTo('c')); c.goN(1); assertThat(c.walkToMatchCheckCase("cdefg"), equalTo(false)); } }