question: public static String replaceParametersWithQuestionMarks ( String statement ) { if ( statement == null ) { return null ; } String result = "" ; int i = 0 ; int len = statement . length ( ) ; char last = '\0' ; while ( i < len ) { char c = statement . charAt ( i ) ; if ( c == '$' ) { last = c ; i ++ ; continue ; } if ( ( last == '$' ) && ( c >= '0' ) && ( c <= '9' ) ) { i ++ ; while ( ( i < len ) && ( Character . isDigit ( statement . charAt ( i ) ) ) ) { i ++ ; } last = '\0' ; c = '?' ; i -- ; } result += c ; i ++ ; } return result ; }
target:  Replace parameters $1, $2, ... with '?'.