"Fossies" - the Fresh Open Source Software Archive 
Member "ansifilter-2.18-x64/src/stringtools.h" (30 Jan 2021, 2324 Bytes) of package /windows/misc/ansifilter-2.18-x64.zip:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
See also the last
Fossies "Diffs" side-by-side code changes report for "stringtools.h":
2.14_vs_2.15.
1 /***************************************************************************
2 stringtools.h - description
3 -------------------
4 begin : Mon Dec 10 2001
5 copyright : (C) 2001 by Andre Simon
6 email : a.simon@mailbox.org
7 ***************************************************************************/
8
9 /*
10 This file is part of ANSIFilter.
11
12 ANSIFilter is free software: you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation, either version 3 of the License, or
15 (at your option) any later version.
16
17 ANSIFilter is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with ANSIFilter. If not, see <http://www.gnu.org/licenses/>.
24 */
25
26 #ifndef STRINGTOOLS_H
27 #define STRINGTOOLS_H
28
29 #include <string>
30 #include <vector>
31 #include <sstream>
32
33 using namespace std;
34
35 /// Contains methods for string manipulation
36
37 namespace StringTools
38 {
39
40 /** convert string to lowercase
41 \param s String
42 \returns lowercase string */
43 string lowerCase(const string &s);
44
45 /** convert string to uppercase
46 \param s String
47 \returns uppercase string */
48 string upperCase(const string &s);
49
50
51 /** \param value String
52 \return string trimmed on the left side
53 */
54 string trimRight(const string &value);
55
56 /** \param s String, containing a opening and a closing paranthesis
57 \return value between "(", ")" */
58 string getParantheseVal(const string &s);
59
60 /** \param s string containing tokens
61 \param delim Token delimiter
62 \return vector containing found tokens */
63 vector <string> splitString(const string& s, unsigned char delim);
64
65 /** \param val variable of specified type which will contain the numeric value
66 \param s string containing a number
67 \param f format specifier function (IO manipulator)
68 \return true if successful */
69 template <class T>
70 bool str2num(T &val, const std::string& s, std::ios_base& (*f)(std::ios_base&))
71 {
72 std::istringstream iss(s);
73 return !(iss >> f >> val).fail();
74 }
75
76 }
77
78 #endif