musrfit 1.10.0
PStringUtils.h
Go to the documentation of this file.
1/***************************************************************************
2
3 PStringUtils.h
4
5 Author: Andreas Suter
6 e-mail: andreas.suter@psi.ch
7
8***************************************************************************/
9
10/***************************************************************************
11 * Copyright (C) 2007-2026 by Andreas Suter *
12 * andreas.suter@psi.ch *
13 * *
14 * This program is free software; you can redistribute it and/or modify *
15 * it under the terms of the GNU General Public License as published by *
16 * the Free Software Foundation; either version 2 of the License, or *
17 * (at your option) any later version. *
18 * *
19 * This program is distributed in the hope that it will be useful, *
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
22 * GNU General Public License for more details. *
23 * *
24 * You should have received a copy of the GNU General Public License *
25 * along with this program; if not, write to the *
26 * Free Software Foundation, Inc., *
27 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
28 ***************************************************************************/
29
30#ifndef _PSTRINGUTILS_H_
31#define _PSTRINGUTILS_H_
32
33#include <string>
34#include <vector>
35
36//-------------------------------------------------------------
57{
58 public:
67 static std::vector<std::string> Split(const std::string &str, const std::string &delimiters);
68
78 static bool IsInt(const std::string &str);
79
88 static bool IsFloat(const std::string &str);
89
103 static int ToInt(const std::string &str, bool *ok = nullptr);
104
117 static double ToDouble(const std::string &str, bool *ok = nullptr);
118
127 static bool IsEqualNoCase(const std::string &a, const std::string &b);
128
137 static bool ContainsNoCase(const std::string &haystack, const std::string &needle);
138
147 static bool BeginsWithNoCase(const std::string &str, const std::string &prefix);
148};
149
150#endif // _PSTRINGUTILS_H_
Lightweight, dependency-free string utilities (pure C++17).
static bool IsFloat(const std::string &str)
static bool ContainsNoCase(const std::string &haystack, const std::string &needle)
static int ToInt(const std::string &str, bool *ok=nullptr)
static bool BeginsWithNoCase(const std::string &str, const std::string &prefix)
static bool IsEqualNoCase(const std::string &a, const std::string &b)
static std::vector< std::string > Split(const std::string &str, const std::string &delimiters)
static double ToDouble(const std::string &str, bool *ok=nullptr)
static bool IsInt(const std::string &str)