Yikes!!! Java suxs big time in string handling – If I have to remove whitespaces from between a string(Buffer) I have to write my own method

Duh!

  • lol, my java prof would have handed you your head on a platter for a statement like that if we all lived in his dream world! And he would’ve made you read about trim() as your last act :))

    naah, hes not that bad

    just curious though, which languages have a function to do what you want it to?

    • He He He!! may be you deserve your prof 😉

      I have been relearning Java since past 15 days but I know trim() will only remove whitespaces from begining and end of the string. I want to remove all whitespaces from *between* a string

      In PHP I can do a replace with a null value and get what I want

      • morning..

        i wasnt suggesting trim() was a solution to your problem. Just that he would make you sing its glories as your last act even if it didnt work for you the way you wanted it to.

        Think theres a replace method in java too, btw.

        • Yes! of course there is a replace command in Java but it takes 2 *characters* as parameters

          • Python: "0-553-38096-6".replace("-", "")

            • Yeah! that is how I would expect a language to behave in terms of convenience, but Java just insists that “” is not a character rather than going ahead and doing the necessary conversion internally.