How to replace special character and its next string with one string

前端 未结 4 1685
无人共我
无人共我 2021-01-22 16:30

How to replace the special character $owner with \"hr\" and $table_name with \"hr\" and $constraint_name with \"scma_constraint\" in dynamic. Change

\"alter ta         


        
4条回答
  •  臣服心动
    2021-01-22 16:40

    The replaceAll method on String should do the trick. First store all the key-value pairs in a Map and then do something as follows:

    for each entry in the map
        myString.replaceAll(entry.key, entry.value)
    

    Should be straigtforward to implement.

提交回复
热议问题