Fledge
An open source edge computing platform for industrial users
All Classes Functions Variables Pages
string_utils.h
1 #ifndef _STRING_UTILS_H
2 #define _STRING_UTILS_H
3 /*
4  * Fledge utilities functions for handling stringa
5  *
6  * Copyright (c) 2019 Dianomic Systems
7  *
8  * Released under the Apache 2.0 Licence
9  *
10  * Author: Stefano Simonelli, Massimiliano Pinto
11  */
12 
13 #include <string>
14 #include <sstream>
15 #include <iomanip>
16 
17 
18 void StringReplace(std::string& StringToManage,
19  const std::string& StringToSearch,
20  const std::string& StringReplacement);
21 
22 void StringReplaceAll(std::string& StringToManage,
23  const std::string& StringToSearch,
24  const std::string& StringReplacement);
25 
26 std::string StringSlashFix(const std::string& stringToFix);
27 std::string evaluateParentPath(const std::string& path, char separator);
28 std::string extractLastLevel(const std::string& path, char separator);
29 
30 void StringStripCRLF(std::string& StringToManage);
31 std::string StringStripWhiteSpacesAll(const std::string& original);
32 std::string StringStripWhiteSpacesExtra(const std::string& original);
33 void StringStripQuotes(std::string& StringToManage);
34 
35 std::string urlEncode(const std::string& s);
36 std::string urlDecode(const std::string& s);
37 void StringEscapeQuotes(std::string& s);
38 
39 char *trim(char *str);
40 std::string StringLTrim(const std::string& str);
41 std::string StringRTrim(const std::string& str);
42 std::string StringTrim(const std::string& str);
43 
44 bool IsRegex(const std::string &str);
45 
46 std::string StringAround(const std::string& str, unsigned int pos,
47  unsigned int after = 30, unsigned int before = 10);
48 
49 void StringReplaceAllEx(std::string& StringToManage,
50  const std::string& StringToSearch,
51  const std::string& StringToChange);
52 
53 std::string escape(const std::string& str);
54 
55 #endif