grblHAL core  20250225
strutils.h
Go to the documentation of this file.
1 /*
2  strutils.h - a collection of useful string utilities
3 
4 Copyright (c) 2019-2022 Terje Io
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without modification,
8 are permitted provided that the following conditions are met:
9 
10 * Redistributions of source code must retain the above copyright notice, this
11 list of conditions and the following disclaimer.
12 
13 * Redistributions in binary form must reproduce the above copyright notice, this
14 list of conditions and the following disclaimer in the documentation and/or
15 other materials provided with the distribution.
16 
17 * Neither the name of the copyright holder nor the names of its contributors may
18 be used to endorse or promote products derived from this software without
19 specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
25 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
28 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 
32 */
33 
34 #ifndef __STRUTILS_H__
35 #define __STRUTILS_H___
36 
37 #include <stdint.h>
38 #include <time.h>
39 
40 char *stristr(const char *s1, const char *s2);
41 char *strnistr (const char *s1, const char *s2, size_t len);
42 char *strappend (char *buf, int argc, ...);
43 uint32_t strnumentries (const char *s, const char delimiter);
44 char *strgetentry (char *res, const char *s, uint32_t entry, const char delimiter);
45 int32_t strlookup (const char *s1, const char *s2, const char delimiter);
46 bool strtotime (char *s, struct tm *time);
47 char *strtoisodt (struct tm *dt);
48 char *strtointernetdt (struct tm *dt);
49 
50 #endif
Definition: vfs.h:47
char * strgetentry(char *res, const char *s, uint32_t entry, const char delimiter)
Definition: strutils.c:139
bool strtotime(char *s, struct tm *time)
Definition: strutils.c:191
char * strnistr(const char *s1, const char *s2, size_t len)
Case insensitive search for first occurrence of a string inside another.
Definition: strutils.c:72
char * stristr(const char *s1, const char *s2)
Case insensitive search for first occurrence of a string inside another.
Definition: strutils.c:37
char * strappend(char *buf, int argc,...)
Definition: strutils.c:106
uint32_t strnumentries(const char *s, const char delimiter)
Definition: strutils.c:126
char * strtointernetdt(struct tm *dt)
Definition: strutils.c:298
int32_t strlookup(const char *s1, const char *s2, const char delimiter)
Definition: strutils.c:166
char * strtoisodt(struct tm *dt)
Definition: strutils.c:288