ft_strsub
This commit is contained in:
parent
1addf7c4ed
commit
c269679e5a
5
Makefile
5
Makefile
@ -6,7 +6,7 @@
|
||||
# By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2018/04/07 12:47:06 by tmaze #+# #+# #
|
||||
# Updated: 2018/04/07 15:33:02 by tmaze ### ########.fr #
|
||||
# Updated: 2018/04/07 15:47:00 by tmaze ### ########.fr #
|
||||
# #
|
||||
#******************************************************************************#
|
||||
|
||||
@ -55,7 +55,8 @@ SRCS = \
|
||||
ft_strmap.c \
|
||||
ft_strmapi.c \
|
||||
ft_strequ.c \
|
||||
ft_strnequ.c
|
||||
ft_strnequ.c \
|
||||
ft_strsub.c
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
INCLS = -I.
|
||||
|
||||
|
22
ft_strsub.c
Normal file
22
ft_strsub.c
Normal file
@ -0,0 +1,22 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_strsub.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2018/04/07 15:35:49 by tmaze #+# #+# */
|
||||
/* Updated: 2018/04/07 16:02:41 by tmaze ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
char *ft_strsub(char const *s, unsigned int start, size_t len)
|
||||
{
|
||||
char *ret;
|
||||
|
||||
if ((ret = ft_strnew(len)) != NULL)
|
||||
ret = ft_strncpy(ret, &s[start], len);
|
||||
return (ret);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user