aboutsummaryrefslogtreecommitdiff
path: root/c02/ex02/ft_str_is_alpha.c
diff options
context:
space:
mode:
Diffstat (limited to 'c02/ex02/ft_str_is_alpha.c')
-rw-r--r--c02/ex02/ft_str_is_alpha.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/c02/ex02/ft_str_is_alpha.c b/c02/ex02/ft_str_is_alpha.c
new file mode 100644
index 0000000..46df96a
--- /dev/null
+++ b/c02/ex02/ft_str_is_alpha.c
@@ -0,0 +1,24 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_str_is_alpha.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/07/03 19:10:32 by cacharle #+# #+# */
+/* Updated: 2019/07/03 19:40:15 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+int is_between(char start, char end, char subject)
+{
+ return (subject >= start && subject <= end);
+}
+
+int ft_str_is_alpha(char *str)
+{
+ while (*str != '\0')
+ if (!is_between('a', 'z', *str) || !is_between('A', 'Z', *str))
+ return (0);
+ return (1);
+}