Check out example codes for "get first and last character of string c++". It will help you in understanding the concepts better.

Code Example 1

auto first_char = str.front()
auto last_char = str.back()

Learn ReactJs, React Native from akashmittal.com