/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strcorr.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: bchanot +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/13 21:19:40 by bchanot #+# #+# */ /* Updated: 2018/10/29 12:12:48 by bchanot ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" char *ft_strcorr(const char *const src, const char c) { int len; int i; i = 0; if (!src || !c) return (NULL); while (src[i] && src[i] == c) i++; if (!src[i]) return (NULL); len = ft_strlen(src) - 1; while (len > 0 && src[len] == c) len--; len++; return (ft_strsub(src, i, len - i)); }