Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#ifndef LOWER_H
#define LOWER_H
#include <iostream>
#include <sstream>
//used to convert a string to lowercase
using namespace std;
string convertToLowercase(string word)
{
// stringstream (<sstream>) cout but into a variable.
stringstream out;
for(size_t i = 0; i < word.length(); i++) //iterate through each character in list
{
char c = word.c_str()[i];
out << char(tolower(c));
}
return out.str(); //return string
}
/*int main(int argc, char* argv[])
{
if (argc < 2)
cout << convertToLowercase(string("ExAmPlE sTrInG"));
else
cout << convertToLowercase(string(argv[1]));
return 0;
} */
#endif