-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringUtils.h
More file actions
38 lines (26 loc) · 1 KB
/
StringUtils.h
File metadata and controls
38 lines (26 loc) · 1 KB
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
38
//
// Created by root on 11/6/17.
//
#ifndef DYNAMIC_SYSTEMS_DSL_TRANSLATOR_STRINGUTILS_H
#define DYNAMIC_SYSTEMS_DSL_TRANSLATOR_STRINGUTILS_H
#include <iostream>
#include <algorithm>
class StringUtils {
public:
// trim from start (in place)
static void ltrim(std::string &s);
// trim from end (in place)
static void rtrim(std::string &s);
// trim from both ends (in place)
static void trim(std::string &s);
// trim from start (copying)
static std::string ltrim_copy(std::string s);
// trim from end (copying)
static std::string rtrim_copy(std::string s);
// trim from both ends (copying)
static std::string trim_copy(std::string s);
static std::string replace(std::string subject, const std::string& search, const std::string& replace);
static std::string replaceFirst(std::string subject, const std::string& search, const std::string& replace);
static int indexOf(const std::string &text, const std::string &target);
};
#endif //DYNAMIC_SYSTEMS_DSL_TRANSLATOR_STRINGUTILS_H