Extend str_isspace to consider \r as whitespace, add documentation

This allows the function to be reused in more places where `\r` is also considered as whitespace.
This commit is contained in:
Robert Müller 2022-09-28 14:12:10 +02:00
parent 38d2131944
commit e98728f8f0
2 changed files with 17 additions and 1 deletions

View file

@ -3369,7 +3369,10 @@ void net_stats(NETSTATS *stats_inout)
*stats_inout = network_stats;
}
int str_isspace(char c) { return c == ' ' || c == '\n' || c == '\t'; }
int str_isspace(char c)
{
return c == ' ' || c == '\n' || c == '\r' || c == '\t';
}
char str_uppercase(char c)
{

View file

@ -2029,7 +2029,20 @@ int str_toint(const char *str);
int str_toint_base(const char *str, int base);
unsigned long str_toulong_base(const char *str, int base);
float str_tofloat(const char *str);
/**
* Determines whether a character is whitespace.
*
* @ingroup Strings
*
* @param c the character to check
*
* @return 1 if the character is whitespace, 0 otherwise.
*
* @remark The following characters are considered whitespace: ' ', '\n', '\r', '\t'
*/
int str_isspace(char c);
char str_uppercase(char c);
int str_isallnum(const char *str);
unsigned str_quickhash(const char *str);