QString str = " Hello World "; str = str.stripWhiteSpace(); // str = "Hello World"
QString str = " \n "; str = str.stripWhiteSpace(); // str = ""In this example, the `stripWhiteSpace()` function removes all the whitespace characters (including the newline character) from the `str` string, resulting in an empty string. The package library for this function is the Qt library for C++.