String trim() - JanKulbaga/String-CPP GitHub Wiki
String trim()
Removes whitespace from both ends of a string and returns a new string.
Example
#include "src/String.h"
int main()
{
String s = " Hello World ";
String s1 = "Hello World ";
String s2 = " Hello World";
s.trim(); // gives value "Hello World"
s1.trim(); // gives value "Hello World"
s2.trim(); // gives value "Hello World"
return 0;
}
Parameters
None
Return value
New string without spaces in both ends.