I am trying to replace a space character into a hyphen I have in my string.
String replaceText = \"AT AT\";
replaceText.replace(\' \', \'-\');
The replace and replaceAll methods return a String with the replaced result. Are you using the returned value, or expecting the replaceText
String to change? If it's the latter, you won't see the change, because Strings are immutable.
String replaceText = "AT AT";
String replaced = replaceText.replace(' ', '-');
// replaced will be "AT-AT", but replaceText will NOT change