I am trying to create an Android calculator which uses strings in Kotlin. I do not know how to delete a comma (or the negative) if it already contains one.
Here is my code which adds the comma correctly but doesn't delete it if the user clicks again:
if (!buClickValue.contains(".")) {
buClickValue += "."
} else {
buClickValue.replace(".", "")
}