Since tolower
only works for individual characters, how would I use tolower
for a string vector? I know I would have to go through each individual character of each item, however I am unsure how to access the individual characters within each item.
eg:-
string vector[Apple, Banana].
vector[0]
is Apple but I want the character not the whole string. Thanks in advance!
std::transform
can help you here to applytolower
to each character in each string inside in your vector:Demo
As @AlanBirtles suggested you could apply
std::transform
for the outer loop too. Then it becomes like this:Demo