-
Notifications
You must be signed in to change notification settings - Fork 0
/
C_02_main.c
92 lines (87 loc) · 3.47 KB
/
C_02_main.c
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sham <sham@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/03/06 13:50:41 by sham #+# #+# */
/* Updated: 2021/03/06 15:02:54 by sham ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <unistd.h>
char *ft_strcpy(char *dest, char *src);
char *ft_strncpy(char *dest, char *src, unsigned int n);
int ft_str_is_alpha(char *str);
int ft_str_is_numeric(char *str);
int ft_str_is_lowercase(char *str);
int ft_str_is_uppercase(char *str);
int ft_str_is_printable(char *str);
char *ft_strupcase(char *str);
char *ft_strlowcase(char *str);
char *ft_strcapitalize(char *str);
unsigned int ft_strlcpy(char *dest, char *src, unsigned int size);
void ft_putstr_non_printable(char *str);
int main()
{
char a1[10];
char a2[10];
printf ("test_ft_strcpy\n");
printf ("%s\n",ft_strcpy(a1,"12345"));
printf ("ft_strncpy\n");
printf ("%s\n",ft_strncpy(a2,"12345", 6));
printf("test_ft_str_is_alpha\n");
printf ("%d\n", ft_str_is_alpha("FAZ"));
printf ("%d\n", ft_str_is_alpha("azfz"));
printf ("%d\n", ft_str_is_alpha("azsdfz"));
printf ("test_ft_str_is_numeric\n");
printf ("%d\n", ft_str_is_numeric("14451"));
printf ("%d\n", ft_str_is_numeric("144fa"));
printf ("%d\n", ft_str_is_numeric("a1a4451"));
printf ("%d\n", ft_str_is_numeric(" "));
printf ("test_ft_str_is_lowercase\n");
printf ("%d\n",ft_str_is_lowercase("afhjz"));
printf ("%d\n",ft_str_is_lowercase("afs hjz"));
printf ("%d\n",ft_str_is_lowercase("afsAShjz"));
printf ("%d\n", ft_str_is_numeric(""));
printf ("test_ft_str_is_uppercase\n");
printf ("%d\n", ft_str_is_uppercase("aASdf"));
printf ("%d\n", ft_str_is_uppercase("AS"));
printf ("%d\n", ft_str_is_uppercase("A S D FS F"));
printf ("%d\n", ft_str_is_uppercase(""));
printf ("test_ft_str_is_printable\n");
printf("%d \n", ft_str_is_printable("FAS#@$! VZ X"));
printf("%d \n", ft_str_is_printable("~"));
printf("%d \n", ft_str_is_printable(" "));
printf("test_ft_strupcase\n");
char str1[] = "asADM_ df,(anoTher), -#@! g.";
char *p = str1;
printf ("%s \n", (ft_strupcase(p)));
printf("test_ft_strlowcase\n");
char str2[] = "DM_df,(anoTher), -#@! g.";
p = str2;
printf ("%s \n", (ft_strlowcase(p)));
printf("test_ft_strcapitalize\n");
char str[]="he l sdj -fsd = f=df=f-f-fs F adFAS FCXs sfF";
ft_strcapitalize(str);
printf ("%s\n", str);
printf("test_ft_strlcpy\n");
char a[10] = "adfg";
char b[10] = "qweryyyy";
printf ("%d \n", ft_strlcpy(a, b, 3));
// printf ("%d \n", ft_strlcpy(a, b, 6));
// printf ("%d \n", ft_strlcpy(a, b, 8));
printf ("%s %s \n", a, b);
printf("ft_putstr_non_printable\n");
char arr[10] = "h\ti\ti a\nm";
int i = 0;
while (i < 10)
{
printf ("%c:%d \n",arr[i], arr[i]);
i++;
}
printf ("\n");
ft_putstr_non_printable(arr);
printf ("\n");
}