public static String replaceByMap ( String _searchStr , Map < String , String > _replacements ) { if ( _searchStr == null ) { return null ; } if ( _replacements == null || _replacements . isEmpty ( ) ) { return _searchStr ; } String str = _searchStr ; for ( Entry < String , String > entry : _replacements . entrySet ( ) ) { str = str . replace ( entry . getKey ( ) , entry . getValue ( ) ) ; } return str ; }
Replace all placeholders in given string by value of the corresponding key in given Map .