lundi 13 septembre 2021

Do I need to check "\001" when checking if a string is empty or not?

I do a query to my backend and get an empty string response. For the scope of this question, it is just okay to understand that I get a json response from the backend.

For one of the fields I get no value as a response but I get "\001" as part the string. This is just null termination. Right? But I was expecting that the following check should cover it.

my_std_string.find_first_not_of(' ') == std::string::npos

If I want to check that a std::string is empty or not, I should also check "\001"?

Aucun commentaire:

Enregistrer un commentaire