This commit is contained in:
Loic Deridder
2025-01-24 10:19:26 +01:00
parent 8dabbc426f
commit c92d92dc99
15 changed files with 1088 additions and 0 deletions

View 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);
}