void clear() - JanKulbaga/String-CPP GitHub Wiki
Erases the contents of the string, which becomes an empty string (with a length of 0 and data nullptr).
#include <ostream>
#include "src/String.h"
int main()
{
String s = "Hello World";
s.clear()
std::cout << s.length() << "\n";
std::cout << s.isEmpty() << "\n";
return 0;
}Output:
0
1None
None