From 479f0d4d0d43d64ce6f3cb141acb9a91605a064f Mon Sep 17 00:00:00 2001 From: Leonetienne Date: Thu, 10 Feb 2022 10:58:54 +0100 Subject: Nyow wepwacing er-endings witw a --- main.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 8c50960..6433b01 100644 --- a/main.cpp +++ b/main.cpp @@ -224,7 +224,7 @@ std::string MakeUwu(std::string boringString) { "ny", [boringString](const std::string &found, int index) { // Don't replace, if we are on the last char - if (index == boringString.length() - 1) + if (index + found.length() == boringString.length() - 1) return false; // Only replace if the next char is a vowel @@ -246,7 +246,7 @@ std::string MakeUwu(std::string boringString) { "w", [boringString](const std::string &found, const std::size_t index) { // Don't replace, if we are on the last char - if (index == boringString.length()) + if (index + found.length() == boringString.length() - 1) return false; // Only replace if the next char is a vowel @@ -292,6 +292,24 @@ std::string MakeUwu(std::string boringString) { } ); + // Replace ER with A, but only if it's the last two letters of a word + boringString = ReplaceButKeepSigns( + boringString, + "er", + "a", + [boringString](const std::string &found, int index) { + // Replace if we're at the end of this line/segment + if (index + found.length() == boringString.length() - 1) + return false; + + // Fetch the next char + const char nextChar = MakeLower(boringString[index + found.length()]); + + // Replace if the next char is not a letter + return IsLetter(nextChar) == false; + } + ); + // Replace random punctuation with uwwwwu cute symbols // About evewy fifteenth symbol std::stringstream ss; -- cgit v1.2.3