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

Code Example 1

void print(const std::string &s)
{
    for (std::string::size_type i = 0; i < s.size(); i++) {
        std::cout << s[i] << ' ';
    }
}

Learn ReactJs, React Native from akashmittal.com