-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring_util.h
More file actions
76 lines (62 loc) · 2.6 KB
/
string_util.h
File metadata and controls
76 lines (62 loc) · 2.6 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
72
73
74
75
76
/**
* @file string_util.h
* @brief GenericCShellParserLIB: A comprehensive and versatile CLI parsing library for C applications.
* @author Harshith Sunku
* @date 12/22/2023
* @version 1.0
* @website https://www.harshith.in/ | https://harshithsunku.in/
* @repository https://github.com/harshithsunku/GenericCShellParserLIB
*
* @note This file is part of GenericCShellParserLIB, which offers robust CLI functionalities for C projects.
* The library includes a range of built-in commands like show, config, debug, clear, and more, making it
* ideal for integrating powerful and customizable shell parsing capabilities into various applications.
* @details Designed for easy integration and extensibility, GenericCShellParserLIB allows developers to quickly
* implement a command-line interface tailored to their application's needs. Further details about the
* implementation can be found in the README or the official documentation at the above website/github.
*
* GenericCShellParserLIB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GenericCShellParserLIB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GenericCShellParserLIB. If not, see <https://www.gnu.org/licenses/>.
*
* @bugs No known bugs at the time of writing.
* @todo Features or fixes planned for future versions.
*/
#ifndef __STRING_UTIL__
#define __STRING_UTIL__
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
char** tokenizer(char* a_str,
const char a_delim,
size_t *token_cnt);
void
string_space_trim(char *string);
void
print_tokens(unsigned int index);
void
init_token_array();
void
re_init_tokens(int token_cnt);
void
tokenize(char *token, unsigned int size, unsigned int index);
void
untokenize(unsigned int index);
char *
get_token(unsigned int index);
void replaceSubstring(char string[], char sub[], char new_str[]);
bool
pattern_match(char string[], int string_size, char pattern[]);
int
grep (char string[], int string_size, char pattern[]);
uint64_t
string_fetch_integer(char *string, int string_size, int index);
#endif