Check out example codes for "how to get string length in c++". It will help you in understanding the concepts better.

Code Example 1

#include <iostream>
#include <string>

int main()
{
  string str = "iftee";
  
  //method 1: using length() function
  int len = str.length();
  cout << "The String Length: " << len << endl;
  
  //method 2: using size() function
  int len2 = str.size();
  cout << "The String Length: " << len2 << endl;
  
  return 0;
}

Code Example 2

string txt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
cout << "The length of the txt 
  string is: " << txt.size();

Code Example 3

string txt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
cout << "The length of the txt 
  string is: " << txt.length();

Learn ReactJs, React Native from akashmittal.com