You are viewing a single comment's thread. Return to all comments →
I tried this code .. it's working fine. But I have one doubt. When the string input is -(hyphen) then I didn't see anycode adding the hyphen to the buffer. But in the print statement it displays the hyphen as well.. can someone please explain the same as I am new in java.
its because every time we are updating the string, if '-' is encountered then nothing will be updated.
because hyphen ascii is not in range of first two if and elif conditions.