The `clear` function is a member function of the C++ standard string library that clears the contents of the string object, leaving it with a size of zero. It takes no parameters and returns void.
Code example:
```c++
#include
#include
int main() {
std::string str = "hello world";
std::cout << "Original string: " << str << std::endl;
str.clear();
std::cout << "String after using clear(): " << str << std::endl;
return 0;
}
```
Package library: Standard Template Library (STL) string library.
C++ (Cpp) String::clear - 30 examples found. These are the top rated real world C++ (Cpp) examples of common::String::clear extracted from open source projects. You can rate examples to help us improve the quality of examples.