28 lines
1.1 KiB
C
Executable file
28 lines
1.1 KiB
C
Executable file
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_strnonchr.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: thrieg <thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2024/10/22 18:39:17 by thrieg #+# #+# */
|
|
/* Updated: 2025/02/16 19:04:56 by thrieg ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "libft.h"
|
|
|
|
//returns the index of the first character that ISN'T c
|
|
// /!\SEGFAULT if str is NULL
|
|
//returns 0 if c is \0
|
|
size_t ft_strnonchr(char *str, char c)
|
|
{
|
|
size_t i;
|
|
|
|
i = 0;
|
|
if (c == '\0')
|
|
return (0);
|
|
while (str[i] == c)
|
|
i++;
|
|
return (i);
|
|
}
|