question: public static StringBuffer stringSubstitution ( String argStr , Map vars ) { StringBuffer argBuf = new StringBuffer ( ) ; for ( int cIdx = 0 ; cIdx < argStr . length ( ) ; ) { char ch = argStr . charAt ( cIdx ) ; switch ( ch ) { case '$' : StringBuffer nameBuf = new StringBuffer ( ) ; for ( ++ cIdx ; cIdx < argStr . length ( ) ; ++ cIdx ) { ch = argStr . charAt ( cIdx ) ; if ( ch == '_' || Character . isLetterOrDigit ( ch ) ) nameBuf . append ( ch ) ; else break ; } if ( nameBuf . length ( ) > 0 ) { String value = ( String ) vars . get ( nameBuf . toString ( ) ) ; if ( value != null ) { argBuf . append ( value ) ; } } break ; default : argBuf . append ( ch ) ; ++ cIdx ; break ; } } return argBuf ; }
target:  Perform a series of substitutions. The substitions are performed by replacing $variable in the target string with the value of provided by the key "variable" in the provided hashtable.