Kage Studio 0.7.240121
A Simple Free and Open Source 2D Animation Software
Loading...
Searching...
No Matches
stringhelper.h
Go to the documentation of this file.
1/*
2 * stringhelper.h
3 *
4 * Copyright 2011-2024 Mj Mendoza IV <mj.mendoza.iv@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
20 *
21 *
22 */
23
24#ifndef UTIL_STRING_HELPER_H
25 #define UTIL_STRING_HELPER_H
26
27 #include <string>
28 #include <sstream>
29 #include <vector>
30 #include <algorithm>
31 #include <cstring>
32 #include <iostream>
33 #include <limits.h>
34
36 public:
37 static std::string toUpper(std::string p_str);
38 static std::string toLower(std::string p_str);
39 static std::string integerToString(int p_src);
40 static std::string unsignedIntegerToString(unsigned int p_src);
41 static std::string doubleToString(double p_src);
42 static int toInteger(std::string p_str);
43 static unsigned int toUnsignedInteger(std::string p_str);
44 static long toLong(std::string p_str);
45 static double toDouble(std::string p_str);
46 static bool toBoolean(std::string p_str);
47 static std::vector<std::string> split(const std::string &p_source, const std::string &p_delimiter);
48 static std::string trim(std::string p_source);
49 static std::string kHash(std::string par, int p_len = 8);
50
51 static std::string replace(std::string s, std::string const& p_find, std::string const& p_replace);
52 static std::string replaceAll(std::string s, std::string const& p_find, std::string const& p_replace);
53
54 static bool isScientificNotation(std::string p_value);
55 static bool isNumeric(std::string p_value);
56 };
57
58#endif //UTIL_STRING_HELPER_H
Definition stringhelper.h:35
static bool toBoolean(std::string p_str)
Definition stringhelper.cpp:116
static std::string integerToString(int p_src)
Definition stringhelper.cpp:44
static std::string toUpper(std::string p_str)
Definition stringhelper.cpp:26
static std::string doubleToString(double p_src)
Definition stringhelper.cpp:64
static std::string kHash(std::string par, int p_len=8)
Definition stringhelper.cpp:176
static std::string trim(std::string p_source)
Definition stringhelper.cpp:145
static bool isScientificNotation(std::string p_value)
Definition stringhelper.cpp:251
static std::vector< std::string > split(const std::string &p_source, const std::string &p_delimiter)
Definition stringhelper.cpp:124
static double toDouble(std::string p_str)
Definition stringhelper.cpp:95
static long toLong(std::string p_str)
Definition stringhelper.cpp:88
static unsigned int toUnsignedInteger(std::string p_str)
Definition stringhelper.cpp:81
static std::string replaceAll(std::string s, std::string const &p_find, std::string const &p_replace)
Definition stringhelper.cpp:226
static std::string unsignedIntegerToString(unsigned int p_src)
Definition stringhelper.cpp:54
static int toInteger(std::string p_str)
Definition stringhelper.cpp:74
static std::string toLower(std::string p_str)
Definition stringhelper.cpp:36
static bool isNumeric(std::string p_value)
Definition stringhelper.cpp:291
static std::string replace(std::string s, std::string const &p_find, std::string const &p_replace)
Definition stringhelper.cpp:219