-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequirement.c
More file actions
47 lines (40 loc) · 771 Bytes
/
requirement.c
File metadata and controls
47 lines (40 loc) · 771 Bytes
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
/*
** EPITECH PROJECT, 2023
** header
** File description:
** header
*/
#include <stdlib.h>
#include <stddef.h>
static int is_letter(char c)
{
if (c >= 'a' && c <= 'z')
return 1;
return 0;
}
static int is_alphanum(char c)
{
if ((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') ||
(c >= 'A' && c <= 'Z'))
return 1;
return 0;
}
static char uncap(char c)
{
char b = c;
b = c - 32;
return b;
}
char *my_strcapitalize_synthesis(char *str)
{
int i = 0;
if (is_letter(str[i]) == 1)
str[i] = uncap(str[i]);
for (i = 1; str[i]; i++) {
if (is_letter(str[i]) == 1 && is_alphanum(str[i - 1]) == 0)
str[i] = uncap(str[i]);
else
str[i] = str[i];
}
return str;
}