fixed issues with punctuation duplicating inside words

compileTime
John Jekel 5 years ago
parent 16d6def15a
commit 454911e0ed
  1. 8
      include/anslatortray.hpp

@ -137,12 +137,14 @@ constexpr char *wordToPig(char *englishWord)
std::string wordToPigPunctuation(const std::string &englishWord)
{
std::string::size_type wordStartIndex {englishWord.find_first_of(Characters::Letters::ALL)};
std::string::size_type wordEndIndex {englishWord.find_last_of(Characters::Letters::ALL)};
std::string::size_type wordEndIndex {englishWord.find_last_of(Characters::Letters::ALL) + 1};
//prefix punctuation + pigified word + suffix punctuation
std::string finished {englishWord.substr(0, wordStartIndex)};
finished += wordToPig(englishWord.substr(0, wordEndIndex + 1));
finished += englishWord.substr(wordEndIndex + 1);
finished += wordToPig(englishWord.substr(wordStartIndex, wordEndIndex- wordStartIndex));//2nd param is count between start and end
finished += englishWord.substr(wordEndIndex);
return finished;
}

Loading…
Cancel
Save