str.h
Go to the documentation of this file.
1 /**
2  * @file str.h
3  * @brief String manipulation helper functions
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2019 Oryx Embedded SARL. All rights reserved.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software Foundation,
23  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24  *
25  * @author Oryx Embedded SARL (www.oryx-embedded.com)
26  * @version 1.9.6
27  **/
28 
29 #ifndef _STR_H
30 #define _STR_H
31 
32 //Dependencies
33 #include "os_port.h"
34 #include "error.h"
35 
36 //C++ guard
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 //String manipulation helper functions
42 char_t *strDuplicate(const char_t *s);
45 void strReplaceChar(char_t *s, char_t oldChar, char_t newChar);
46 
47 error_t strSafeCopy(char_t *dest, const char_t *src, size_t destSize);
48 
49 //C++ guard
50 #ifdef __cplusplus
51 }
52 #endif
53 
54 #endif
void strRemoveTrailingSpace(char_t *s)
Removes all trailing whitespace from a string.
Definition: str.c:117
char_t * strDuplicate(const char_t *s)
Duplicate a string.
Definition: str.c:42
char_t * strTrimWhitespace(char_t *s)
Removes all leading and trailing whitespace from a string.
Definition: str.c:78
error_t
Error codes.
Definition: error.h:42
void strReplaceChar(char_t *s, char_t oldChar, char_t newChar)
Replace all occurrences of the specified character.
Definition: str.c:144
Error codes description.
error_t strSafeCopy(char_t *dest, const char_t *src, size_t destSize)
Copy string.
Definition: str.c:167
char char_t
Definition: compiler_port.h:43
RTOS abstraction layer.