Java has two String methods strip and trim. They do almost exactly the same thing, but strip is safe for Unicode.
QOTO: Question Others to Teach Ourselves An inclusive, Academic Freedom, instance All cultures welcome. Hate speech and harassment strictly forbidden.