Java -Saitenstreifen

/**
strip() is an instance method that returns a string whose value is the string with all leading and trailing white spaces removed. This method was introduced in Java 11.

If the string contains only white spaces, then applying this method will result in an empty string.
*/

public class Main {

    public static void main(String[] args) {
        String s = "    ";
        System.out.println("\"" + s + "\" - \"" + s.strip() + "\"");
        s = "   hello    ";
        System.out.println("\"" + s + "\" - \"" + s.strip() + "\"");
        s = "h i  ";
        System.out.println("\"" + s + "\" - \"" + s.strip() + "\"");
    }
}

// OUTPUT

/**

"    " - ""
"   hello    " - "hello"
"h i  " - "h i"

*/
Zealous Zebra