I have a String in which I'm trying to replace all individual characters (except for spaces) surrounded by spaces with hyphens.
I thought the code to do this would look something like this:
str = str.replaceAll(" ^\\s ", " - ");
However, this doesn't work, so if someone has a solution, it'd be much appreciated.