-
Notifications
You must be signed in to change notification settings - Fork 0
/
cut_space.c
42 lines (37 loc) · 1.39 KB
/
cut_space.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* cut_space.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kaoyama <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/05/08 15:43:43 by takokamo #+# #+# */
/* Updated: 2022/05/08 20:48:21 by kaoyama ### ########.fr */
/* */
/* ************************************************************************** */
#include "declaration.h"
char *cut_space_value(char *str)
{
int i;
i = 0;
while (str[i] == ' ' || str[i] == '\f' || str[i] == '\n' || str[i] == '\r'
|| str[i] == '\t' || str[i] == '\v')
i++;
return (&str[i]);
}
int cut_space_key(char *str)
{
int i;
unsigned int num;
i = 0;
num = 0;
while (str[i] == ' ' || str[i] == '\f' || str[i] == '\n' || str[i] == '\r'
|| str[i] == '\t' || str[i] == '\v')
i++;
while (str[i] >= '0' && str[i] <= '9')
{
num = (num * 10) + (str[i] - '0');
i++;
}
return (num);
}