Replacing all characters between starting character "+" and end character "+" with the equal number of "-" characters.
My specific situation is as follows:
Input: +-+-+-+
Output: +-----+
String s = = "+-+-+-+";
s = s.replaceAll("-\\+-","---")
This is not working. How can I achieve the output in Java? Thanks in advance.