tests d'une autre maniere de faire split en cas de str NULL

This commit is contained in:
Hugo LAMY
2019-12-13 01:36:19 +01:00
parent 5afa7e74f7
commit 18ad78eb17
2 changed files with 6 additions and 5 deletions

View File

@@ -6,7 +6,7 @@
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */ /* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2019/12/12 22:41:54 by hulamy #+# #+# */ /* Created: 2019/12/12 22:41:54 by hulamy #+# #+# */
/* Updated: 2019/12/12 22:41:56 by hulamy ### ########.fr */ /* Updated: 2019/12/13 01:35:15 by hulamy ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -59,16 +59,16 @@
** char c; ** char c;
** **
** i = -1; ** i = -1;
** s = "svh ile ifh oiuo"; ** s = NULL;
** c = ' '; ** c = ' ';
** str = ft_split(s, c); ** str = ft_split(s, c);
** if (str) ** //if (str)
** { ** //{
** printf("s : '%s'\n", s); ** printf("s : '%s'\n", s);
** printf("*str : '%p'\n", str[0]); ** printf("*str : '%p'\n", str[0]);
** while (str[++i]) ** while (str[++i])
** printf("str[%i] : '%s'\n", i, str[i]); ** printf("str[%i] : '%s'\n", i, str[i]);
** } ** //}
** return (0); ** return (0);
** } ** }
*/ */

View File

@@ -138,6 +138,7 @@ int main()
print_ft_strtrim("efzfe fzef", ""); print_ft_strtrim("efzfe fzef", "");
print_ft_strtrim("efzfzelelijz", " "); print_ft_strtrim("efzfzelelijz", " ");
print_ft_strtrim(" e f zfzelelijz ", " "); print_ft_strtrim(" e f zfzelelijz ", " ");
print_ft_strtrim("cccccccccccccccccccc", "c");
printf("\n"); printf("\n");