-
Notifications
You must be signed in to change notification settings - Fork 0
/
stringutil.h
26 lines (18 loc) · 935 Bytes
/
stringutil.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
#ifndef __STRINGUTIL_H__
#define __STRINGUTIL_H__
#include <string>
using namespace std;
/* Returns true iff "s" has "suffix" as a suffix */
bool endsWith(const char *s, const char *suffix);
/* Trims the whitespace ( \t\n) from both ends. Modifies the right end. Returns a pointer inside the given string. */
char* trim(char *s);
/* Removes at most one set of doublequotes from both ends. Modifies the right end. Returns a pointer inside the given string.
* Does nothing and returns s if the quotes don't match. */
char* unquote(char *s);
/* Splits the string at the first occurrence of separator. Replaces the separator char with '\0'.
* Returns a pointer to the character following the separator.
* If there are no occurrences of the separator, returns null and leaves s unchanged. */
char* split(char *s, char separator);
/* Returns true iff the string represents a board in FEN notation. */
bool isFen(string s);
#endif