I am trying to replace a space character into a hyphen I have in my string.
String replaceText = \"AT AT\"; replaceText.replace(\' \', \'-\');
The replace method returns a String, so you need to re-assign your string variable i.e.
String replaceText = "AT AT"; replaceText = replaceText.replace(' ', '-');