TrimString is an existing alternative. I patterned TrimRight after it.
Note TrimString and uses TrimRight" \f\n\r\t\v" as the pattern, which is consistent with the default behavior of std::isspace.
https://en.cppreference.com/w/cpp/string/byte/isspace