Check out example codes for "what is difffrence between s.length() and s.size()". It will help you in understanding the concepts better.
Code Example 1
The size() function is consistent with other STL containers (like vector, map, etc.) and length() is consistent with most peoples intuitive notion of character strings like a word, sentence or paragraph. We say a paragraph'ss length not its size, so length() is to make things more readable.
Learn ReactJs, React Native from akashmittal.com