@Test public void testIsTagOutsideOfBackTicks() { assertFalse(isTagOutsideOfBackticks("abc `<def></def>`")); assertFalse(isTagOutsideOfBackticks("abc `<def>` abc")); assertFalse(isTagOutsideOfBackticks("asd `<abc></abc>")); assertFalse(isTagOutsideOfBackticks("`<hij></hij>`")); assertFalse(isTagOutsideOfBackticks("")); assertFalse(isTagOutsideOfBackticks("A")); assertTrue(isTagOutsideOfBackticks("<A></A>")); assertTrue(isTagOutsideOfBackticks("test `<a></a>` <A></A>")); assertTrue(isTagOutsideOfBackticks("<A></A> `<a></a>`")); assertTrue(isTagOutsideOfBackticks("<A> `<a></a>`")); }
public static boolean isTagOutsideOfBackticks(String text) { int i = 0; boolean inBacktick = false; while (i < text.length()) { char c = text.charAt(i); if (c == '`') { if (inBacktick) { inBacktick = false; } else { inBacktick = true; } } else if (c == '<') { i++; while (i < text.length()) { c = text.charAt(i); if (c == '`') { i--; break; } if (c == '>') { if (!inBacktick) { return true; } break; } i++; } } i++; } return false; }
StringUtils { public static boolean isTagOutsideOfBackticks(String text) { int i = 0; boolean inBacktick = false; while (i < text.length()) { char c = text.charAt(i); if (c == '`') { if (inBacktick) { inBacktick = false; } else { inBacktick = true; } } else if (c == '<') { i++; while (i < text.length()) { c = text.charAt(i); if (c == '`') { i--; break; } if (c == '>') { if (!inBacktick) { return true; } break; } i++; } } i++; } return false; } }
StringUtils { public static boolean isTagOutsideOfBackticks(String text) { int i = 0; boolean inBacktick = false; while (i < text.length()) { char c = text.charAt(i); if (c == '`') { if (inBacktick) { inBacktick = false; } else { inBacktick = true; } } else if (c == '<') { i++; while (i < text.length()) { c = text.charAt(i); if (c == '`') { i--; break; } if (c == '>') { if (!inBacktick) { return true; } break; } i++; } } i++; } return false; } private  StringUtils(); }
StringUtils { public static boolean isTagOutsideOfBackticks(String text) { int i = 0; boolean inBacktick = false; while (i < text.length()) { char c = text.charAt(i); if (c == '`') { if (inBacktick) { inBacktick = false; } else { inBacktick = true; } } else if (c == '<') { i++; while (i < text.length()) { c = text.charAt(i); if (c == '`') { i--; break; } if (c == '>') { if (!inBacktick) { return true; } break; } i++; } } i++; } return false; } private  StringUtils(); static boolean isEmpty(String value); static boolean isQuote(char c); static boolean isWhitespace(String value, int index); static boolean isWhitespace(String value, int index, int end); static boolean isWhitespace(String value); static boolean isBlank(String value); static void normalizeSpace(String str, StringBuilder b); static String normalizeSpace(String str); static String getStartWhitespaces(String lineText); static String getWhitespaces(String text, int start, int end); static void trimNewLines(String value, StringBuilder s); static String trimNewLines(String value); static String lTrim(String value); static int getNumberOfNewLines(String text, boolean isWhitespace, String delimiter, int newLineLimit); static String getDefaultString(String text); static int getOffsetAfterWhitespace(String text, int endOffset); static int getFrontWhitespaceLength(String text); static int getTrailingWhitespaceLength(String text); static String cleanPathForWindows(String pathString); static String escapeBackticks(String text); static boolean isTagOutsideOfBackticks(String text); static String getString(Object obj); static int findStartWord(String text, int offset, Predicate<Character> isValidChar); static int findEndWord(String text, int offset, Predicate<Character> isValidChar); static String convertToQuotelessValue(String value); static boolean isQuoted(String value); }
StringUtils { public static boolean isTagOutsideOfBackticks(String text) { int i = 0; boolean inBacktick = false; while (i < text.length()) { char c = text.charAt(i); if (c == '`') { if (inBacktick) { inBacktick = false; } else { inBacktick = true; } } else if (c == '<') { i++; while (i < text.length()) { c = text.charAt(i); if (c == '`') { i--; break; } if (c == '>') { if (!inBacktick) { return true; } break; } i++; } } i++; } return false; } private  StringUtils(); static boolean isEmpty(String value); static boolean isQuote(char c); static boolean isWhitespace(String value, int index); static boolean isWhitespace(String value, int index, int end); static boolean isWhitespace(String value); static boolean isBlank(String value); static void normalizeSpace(String str, StringBuilder b); static String normalizeSpace(String str); static String getStartWhitespaces(String lineText); static String getWhitespaces(String text, int start, int end); static void trimNewLines(String value, StringBuilder s); static String trimNewLines(String value); static String lTrim(String value); static int getNumberOfNewLines(String text, boolean isWhitespace, String delimiter, int newLineLimit); static String getDefaultString(String text); static int getOffsetAfterWhitespace(String text, int endOffset); static int getFrontWhitespaceLength(String text); static int getTrailingWhitespaceLength(String text); static String cleanPathForWindows(String pathString); static String escapeBackticks(String text); static boolean isTagOutsideOfBackticks(String text); static String getString(Object obj); static int findStartWord(String text, int offset, Predicate<Character> isValidChar); static int findEndWord(String text, int offset, Predicate<Character> isValidChar); static String convertToQuotelessValue(String value); static boolean isQuoted(String value); static final String[] EMPTY_STRING; static final String TRUE; static final String FALSE; static final Collection<String> TRUE_FALSE_ARRAY; }