-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_lowercase.c
More file actions
35 lines (32 loc) · 1.23 KB
/
Copy pathft_lowercase.c
File metadata and controls
35 lines (32 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lowercase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gdannay <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/11/14 18:15:11 by gdannay #+# #+# */
/* Updated: 2017/11/14 18:19:19 by gdannay ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include <stdlib.h>
#include <string.h>
char *ft_lowercase(char *s)
{
int i;
char *new;
i = 0;
if ((new = (char *)malloc(sizeof(char) * (ft_strlen(s) + 1))) == NULL)
return (NULL);
while (s[i] != '\0')
{
if (s[i] >= 'A' && s[i] <= 'Z')
new[i] = s[i] - 'A' + 'a';
else
new[i] = s[i];
i++;
}
new[i] = '\0';
return (new);
}