Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- std::string stripnonalp(std::string input_string)
- {
- std::string output_string = "";
- bool lastwasspace = false;
- for (char current_letter : input_string)
- {
- std::cout << "processing letter " << cu
- current_letter = tolower(current_letter);
- if (lastwasspace == false)
- {
- if((current_letter==32) || (current_letter==13) || (current_letter==10))
- {
- lastwasspace = true;
- output_string += " ";
- }
- if(current_letter==44)
- {
- output_string+= "'";
- lastwasspace = false;
- }
- if((current_letter>='a') && (current_letter<='z'))
- {
- output_string += current_letter;
- lastwasspace=false;
- }
- }
- else
- {
- if(current_letter==44)
- {
- output_string+= "'";
- lastwasspace = false;
- }
- if((current_letter>='a') && (current_letter<='z'))
- {
- output_string += current_letter;
- lastwasspace = false;
- }
- }
- }
- return output_string;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement