-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexample.cpp
More file actions
48 lines (38 loc) · 1.01 KB
/
example.cpp
File metadata and controls
48 lines (38 loc) · 1.01 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
39
40
41
42
43
44
45
46
47
48
#include <iostream>
#include <string>
#include "StringHelper.h"
using namespace std;
bool checkSimbols(char c)
{
char arr[] = {'e', 'f', 'k', 'm', 's', 'x', '1', '2'};
bool flag = false;
for (int i = 0; i <= sizeof(arr) / sizeof(char) && !flag; i++)
{
if (arr[i] == c)
flag = true;
}
return flag;
}
int main()
{
string str = "1This text is a bit strange! Yeah!2 ";
string sep = "!";
string temp = "?!";
StringHelper ss(str);
cout << "before trim " << str.length() << " symbols length" << endl;
ss.lr_trim();
cout << str << endl;
cout << "after trim " << str.length() << " symbols length. Left and right backspaces is removed" << endl;
string sset = " Some message: ";
ss.set(sset, 0);
cout << str << endl;
ss.wrap("message", "<<", ">>", 0, 0);
cout << str << endl;
ss.replace(temp, sep, 0, 0)->reverse(); // can do ss.replace(temp, sep, 0, 0)
cout << str << endl;
ss.reverse(checkSimbols);
cout << str << endl;
ss.reverse();
cout << str << endl;
return 0;
}