1234567891011121314151617 |
- /* Write a function that maps files to their extension names.
- */
- std::vector<std::string> getExtension(std::vector<std::string> arr) {
- std::vector<std::string> extensions;
- for(int i=0;i<arr.size();i++){
- // create a std::string and assign the element value to the variable
- std::string tempstring = arr[i];
- for(int j=tempstring.size();j>0;j--){
- if(tempstring[j]== '.'){
- extensions.push_back(tempstring.substr(j+1));
- break;
- }
- }
- }
- return extensions;
- }
|