string:size

C++ Reference

size

Syntax:

    #include <string>
    size_type size() const;

The size function returns the number of elements in the current string.

If testing whether a string is empty or not, use empty since it doesn't need to count beyond the first character in the string.

Related Topics: capacity, empty, length, max_size, resize