1234567891011121314151617181920212223 |
- /* Create a function that takes an array of names and returns
- * an array with the first letter capitalized.
- * Don't change the order of the original array.
- * Notice in the second example above, "MABELLE" is returned as "Mabelle".
- */
- // make me a lowerCASER for christmas std::string vs string&
- void lowerCase(std::string& strToConvert){
- for(unsigned int i=0;i<strToConvert.length();i++){
- strToConvert[i] = tolower(strToConvert[i]);
- }
- }
- std::vector<std::string> capMe(std::vector<std::string> arr) {
- std::vector<std::string> aA;
- for(int i = 0;i<arr.size();i++){
- // make all characters of each string in the array lower case
- lowerCase(arr[i]);
- // make the first character of each string in the array upper case
- arr[i][0] = toupper(arr[i][0]);
- // add each new string into a new array
- aA.push_back(arr[i]);
- }
- return aA;
- }
|