int (@NotNull String pattern, int current) { if (!(current - 1 >= 0 && pattern.charAt(current - 1) == '\'')) { return -1; } String nextPattern = pattern.substring(current); int from = 0; int nextQuote; while (true) { nextQuote = nextPattern.indexOf('\'', from); if (nextQuote == -1) { return -1; } if (nextPattern.length() > nextQuote + 1 && nextPattern.charAt(nextQuote + 1) == '\'') { from = nextQuote + 2; continue; } break; } nextPattern = nextPattern.substring(0, nextQuote); if (nextPattern.startsWith("{") && nextPattern.endsWith("}") && nextPattern.indexOf("}