-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcstring.h
More file actions
71 lines (60 loc) · 1.12 KB
/
cstring.h
File metadata and controls
71 lines (60 loc) · 1.12 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
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
/*
* cstring.h
*
* Created on: Dec 30, 2014
* Author: muneer
*/
#ifndef CSTRING_H_
#define CSTRING_H_
/**
* t_cstring
*
* A struct to pretend like a String
*/
typedef struct C_String {
int size;
char *value;
} t_cstring;
/**
* Create and return a t_cstring type
*/
t_cstring *cstring_create();
/**
* Free the allocated memory
*
* @param t_msring
* @return int
*/
int cstring_delete(t_cstring *string);
/**
* Add char array to t_cstring
*
* @param t_cstring
* @param char*
* @return int
*/
int cstring_add(t_cstring *string, char *s);
/**
* Assign initial value to the t_cstring
* @param t_cstring
* @param char*
* @return int
*/
int cstring_assign(t_cstring *string, const char *str);
/**
* Compare two t_cstrings
*/
int cstring_compare(t_cstring *str1, t_cstring *str2);
/**
* Substring function
*/
int cstring_substring(t_cstring *string, int start, int length);
/**
* Find the position of specified character
*/
int cstring_charpos(t_cstring *string, const char c);
/**
* Find the position of specified char *
*/
int cstring_strpos(t_cstring *string, const char *str);
#endif /* CSTRING_H_ */