-
Notifications
You must be signed in to change notification settings - Fork 0
/
column_pos.c
31 lines (28 loc) · 1.09 KB
/
column_pos.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* column_pos.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sky <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/09/12 01:36:39 by sky #+# #+# */
/* Updated: 2020/09/13 01:29:31 by sky ### ########.fr */
/* */
/* ************************************************************************** */
#include "csvlib.h"
int column_pos(int i, char *str, char simv)
{
int k;
k = 0;
if (!str || !simv)
return (-1);
while (str[k])
{
if (str[k] == simv)
i--;
if (!i)
return (k);
k++;
}
return (0);
}