how to calculate length of the string in cpp code example Example: length of string in c++ str.length();