Change string based on input string

I have requirement to change the value of a string in mapper based on the input string e.g.

Input value - Salary, must be replaced with IT_DEPT_COST when mapping to a variable
Input value - Phone, must be replaced with ALL_DEPT_PHONE when mapping to variable

Can you please suggest how to do it?

.replaceAll() is the method you need. If these 2 values are the only ones you need to replace than you can apply the above method with hardcoded values. Example :


If you have more values to replace than I suggest you to setup a config file.


1 Like