I would like to remove the leading spaces in the line, but not removing the trailing spaces - so trim () will not work. In python, I use lstrip (), but I'm not sure if there is an equivalent in Java.
As an example
" foobar "
should become
"foobar "
I would also like to avoid using Regex, if at all possible.
Is there a built-in function in Java or do I need to create my own method for this? (and what is the shortest way I could achieve this)
source
share