presto-main/src/main/java/io/prestosql/operator/scalar/CharacterStringCasts.java/CharacterStringCasts/trimTrailing
class CharacterStringCasts:    private static List<Integer> trimTrailing(List<Integer> codePoints, int codePointToTrim)
    {
        int endIndex = codePoints.size();
        while (endIndex > 0 && codePoints.get(endIndex - 1) == codePointToTrim) {
            endIndex--;
        }
        return ImmutableList.copyOf(codePoints.subList(0, endIndex));
    }