-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathString.h
47 lines (42 loc) · 1.18 KB
/
String.h
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
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
/*
Type defs for char pointer
*/
typedef char * Strings;
/*
Type def for structs
*/
typedef struct strStruct String;
/*
Struct setup includes string and methods associated with it
1. charAt -> to get character at specified index
*/
struct strStruct {
char (*charAt)(Strings, int);
int (*compareTo)(Strings, Strings);
Strings(*concat)(Strings, Strings);
int (*contains)(Strings, Strings);
int (*endsWith)(Strings, Strings);
long (*hashCode)(Strings);
int (*equals)(Strings, Strings);
int (*equalsIgnoreCase)(Strings, Strings);
Strings(*toLowerCase)(Strings);
Strings(*toUpperCase)(Strings);
int (*indexOf)(Strings, Strings);
int (*indexOfWithStart)(Strings, Strings, int);
int (*isEmpty)(Strings);
int (*lastIndexOf)(Strings, Strings);
int (*lastIndexOfWithStart)(Strings, Strings, int);
Strings(*replaceChar)(Strings, char, char);
Strings(*replaceString)(Strings, Strings, Strings);
Strings *(*split)(Strings, Strings);
Strings (*trim) (Strings);
Strings (*subString) (Strings, int, int);
};
/*
Method to initialize the default settings for struct.
*/
String *init();