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

Code Example 1

#include<iostream>
using namespace std;
main() {
   string my_str = "Hello World";
   for(int i = 0; i<my_str.length(); i++) {
      cout << my_str.at(i) << endl; //get character at position i
   }
}

Learn ReactJs, React Native from akashmittal.com