Issue
What's up! So I'm trying to make a calculator in Android Studio with kotlin and i try to allow users to make numbers negative and positive, but I got only half of it, making number negative, but can't make it so it turn back to positive, for it I need to remove first char in string, someone knows how to do it? Thanks in advance!
var firstNumber: String = ...
if (firstNumber[0] == '-') {
firstNumber.
}
Solution
You could use substring
:
firstNumber = firstNumber.substring(1);
Answered By - Mureinik
Answer Checked By - Senaida (JavaFixing Volunteer)