xerus
a general purpose tensor library
stringUtilities.h
Go to the documentation of this file.
1 // Xerus - A General Purpose Tensor Library
2 // Copyright (C) 2014-2017 Benjamin Huber and Sebastian Wolf.
3 //
4 // Xerus is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as published
6 // by the Free Software Foundation, either version 3 of the License,
7 // or (at your option) any later version.
8 //
9 // Xerus is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
13 //
14 // You should have received a copy of the GNU Affero General Public License
15 // along with Xerus. If not, see <http://www.gnu.org/licenses/>.
16 //
17 // For further information on Xerus visit https://libXerus.org
18 // or contact us at contact@libXerus.org.
19 
25 #pragma once
26 
27 #include <string>
28 #include <vector>
29 
30 #include "standard.h"
31 
32 namespace xerus {
33  namespace misc {
35  std::string XERUS_warn_unused demangle_cxa(const std::string& _cxa);
36 
38  std::string XERUS_warn_unused normalize_pathname(const std::string& _name);
39 
41  std::vector<std::string> explode(const std::string& _string, const char _delim);
42 
44  void replace(std::string& _string, const std::string& _search, const std::string& _replace);
45 
47  std::string XERUS_warn_unused trim(const std::string& _string, const std::string& whitespace = " \t\n\r\v");
48 
50  std::string XERUS_warn_unused reduce(const std::string& _string, const std::string& whitespace = " \t\n\r\v", const std::string& fill = " ");
51  }
52 }
The main namespace of xerus.
Definition: basic.h:37
std::string XERUS_warn_unused trim(const std::string &_string, const std::string &whitespace=" \\")
: Removes all leading and trailing whitespaces from _string.
#define XERUS_warn_unused
Definition: standard.h:78
std::string XERUS_warn_unused reduce(const std::string &_string, const std::string &whitespace=" \\", const std::string &fill=" ")
: Removes all leading and trailing whitespaces from _string, and reduces all double whitespaces to on...
std::string XERUS_warn_unused demangle_cxa(const std::string &_cxa)
Demangles the function and class names created by gcc into a more readable format.
std::string XERUS_warn_unused normalize_pathname(const std::string &_name)
Resolves &#39;folder/..&#39; occurences in pathnames.
void replace(std::string &_string, const std::string &_search, const std::string &_replace)
: Replaces all occurences of _search in _string by _replace.
Header file for global shorthand notations of elementary integer types and attribute lists...
std::vector< std::string > explode(const std::string &_string, const char _delim)
: Explodes a string at positions indicated by _delim.