I have a string like
(&(objectclass=${abc})(uid=${xyz}))
How can I search ${abc} and ${xyz} and replace with another strings. There can be any number of occurence of such substrings i.e.${abc} in main string. I was thinking of string.indexOf( but that could be messy. Any best approach?
${abc} will be replaced by another string abc. I will get them from some other parameters.
I would use
String.indexOf(String sep, int start)in a loop repeatedly to copy text and values to a StringBuilder.Something like
prints
It gets messy if you want to support nested
${ }values. 😉I would suggest you keep it simple if you can. 😉