public static String removeNonLiteralSpaces(String toRemove) {
        char[] chars = toRemove.toCharArray();
        toRemove = "";

        boolean inQuotes = false;

        for(char c : chars) {
            if(c == '"') {
                inQuotes = !inQuotes;
            }
            if(!inQuotes) {
                if(c != ' ') {
                    toRemove += c;
                }
            } else {
                toRemove += c;
            }
        }

        return toRemove;
    }