charon-core  0.3.1
StringTool.h
Go to the documentation of this file.
1 /* This file is part of Charon.
2 
3  Charon is free software: you can redistribute it and/or modify
4  it under the terms of the GNU Lesser General Public License as published by
5  the Free Software Foundation, either version 3 of the License, or
6  (at your option) any later version.
7 
8  Charon is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU Lesser General Public License for more details.
12 
13  You should have received a copy of the GNU Lesser General Public License
14  along with Charon. If not, see <http://www.gnu.org/licenses/>.
15 */
23 #ifndef _StringTool_H
24 #define _StringTool_H
25 
26 #include <string>
27 #include <vector>
28 #include "DllEx.h"
29 
31 namespace StringTool {
37  std::string charon_core_DLL_PUBLIC trimRight(const std::string& s,
38  const std::string& t = " \t\r\n");
39 
45  std::string charon_core_DLL_PUBLIC trimLeft(const std::string& s,
46  const std::string& t = " \t\r\n");
47 
53  std::string charon_core_DLL_PUBLIC trim(const std::string& s,
54  const std::string& t = " \t\r\n");
55 
61  void charon_core_DLL_PUBLIC explode(std::string str, char delimiter,
62  std::vector<std::string>& result);
63 
68  std::string charon_core_DLL_PUBLIC toLowerCase(std::string s);
69 
75  std::string charon_core_DLL_PUBLIC combine(std::vector<std::string> strings,char delim=';');
76 }
77 
78 #endif
std::string charon_core_DLL_PUBLIC trim(const std::string &s, const std::string &t=" \t\r\n")
Remove (whitespace) characters from head and tail of a string.
Definition: StringTool.cpp:41
std::string charon_core_DLL_PUBLIC trimLeft(const std::string &s, const std::string &t=" \t\r\n")
Remove (whitespace) characters from the head of a string.
Definition: StringTool.cpp:36
void charon_core_DLL_PUBLIC explode(std::string str, char delimiter, std::vector< std::string > &result)
Use delimiter to split the string in a list of substrings.
Definition: StringTool.cpp:46
#define charon_core_DLL_PUBLIC
Preprocessor macro to define this class/function as public visible, i.e.
Definition: DllEx.h:82
Dynamic library API import/export prprocessor macros.
std::string charon_core_DLL_PUBLIC combine(std::vector< std::string > strings, char delim=';')
Combine a vector of strings to one string.
Definition: StringTool.cpp:61
std::string charon_core_DLL_PUBLIC toLowerCase(std::string s)
Convert a string to lowercase.
Definition: StringTool.cpp:55
std::string charon_core_DLL_PUBLIC trimRight(const std::string &s, const std::string &t=" \t\r\n")
Remove (whitespace) characters from the tail of a string.
Definition: StringTool.cpp:27