presto-cli/src/main/java/io/prestosql/cli/TableNameCompleter.java/TableNameCompleter/findLastBlank
class TableNameCompleter:    private static int findLastBlank(String buffer)
    {
        for (int i = buffer.length() - 1; i >= 0; i--) {
            if (Character.isWhitespace(buffer.charAt(i))) {
                return i;
            }
        }
        return -1;
    }