question: public static int countArgumentPlaceholders ( final String messagePattern ) { if ( messagePattern == null ) { return 0 ; } final int delim = messagePattern . indexOf ( DELIM_START ) ; if ( delim == - 1 ) { return 0 ; } int result = 0 ; boolean isEscaped = false ; for ( int i = 0 ; i < messagePattern . length ( ) ; i ++ ) { final char curChar = messagePattern . charAt ( i ) ; if ( curChar == ESCAPE_CHAR ) { isEscaped = ! isEscaped ; } else if ( curChar == DELIM_START ) { if ( ! isEscaped && i < messagePattern . length ( ) - 1 && messagePattern . charAt ( i + 1 ) == DELIM_STOP ) { result ++ ; i ++ ; } isEscaped = false ; } else { isEscaped = false ; } } return result ; }
target:  Counts the number of unescaped placeholders in the given messagePattern.