fprintf
This commit is contained in:
38
lib/libft/srcs/fprintf/ft_flags_utils.c
Normal file
38
lib/libft/srcs/fprintf/ft_flags_utils.c
Normal file
@@ -0,0 +1,38 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_flags_utils.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: lderidde <lderidde@student.s19.be> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/29 12:31:24 by lderidde #+# #+# */
|
||||
/* Updated: 2024/10/31 12:51:29 by lderidde ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "ft_fprintf.h"
|
||||
|
||||
int ft_isflag(char c)
|
||||
{
|
||||
if (is_flag(c) || is_spec(c) || (c >= '0' && c <= '9'))
|
||||
return (1);
|
||||
else
|
||||
return (0);
|
||||
}
|
||||
|
||||
int is_flag(char c)
|
||||
{
|
||||
if (c == '-' || c == '0' || c == '.' || c == '#' || c == '+' || c == ' ')
|
||||
return (1);
|
||||
else
|
||||
return (0);
|
||||
}
|
||||
|
||||
int is_spec(char c)
|
||||
{
|
||||
if (c == 'c' || c == 's' || c == 'p' || c == 'd' || c == 'i' || c == 'u'
|
||||
|| c == 'x' || c == 'X' || c == '%')
|
||||
return (1);
|
||||
else
|
||||
return (0);
|
||||
}
|
||||
Reference in New Issue
Block a user