summaryrefslogtreecommitdiffstats
path: root/Src/StringTools.h
blob: d65772ae4dd6bf8ca8ab80b12086c69fb4b934e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef STRINGTOOLS_STRINGTOOLS_H
#define STRINGTOOLS_STRINGTOOLS_H

#include <string>
#include <vector>

/* Handy utensils to manipulate strings */
class StringTools
{
public:
  //! Will replace every occurence of `find` in `str` by `subst`.
  static std::string Replace(const std::string& str, const char find, const std::string& subst);

  //! Will replace every occurence of `find` in `str` by `subst`.
  static std::string Replace(const std::string& str, const std::string& find, const std::string& subst);

  //! Will replace every occurence of `find` in `str` by `subst`.
  static std::string Replace(const std::string& str, const char find, const char subst);

  //! Will replace every occurence of `find` in `str` by `subst`.
  static std::string Replace(const std::string& str, const std::string& find, const char subst);

  //! Will make a string all-lowercase.
  static std::string Lower(const std::string& str);

  //! Will make a string all-uppercase.
  static std::string Upper(const std::string& str);

  //! Will split a string by a string seperator
  static std::vector<std::string> Split(const std::string& str, const std::string& seperator);

private:
  // No instanciation! >:(
  StringTools();
};

#endif //STRINGTOOLS_STRINGTOOLS_H