-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththegerk_clean.cpp
54 lines (50 loc) · 1.13 KB
/
thegerk_clean.cpp
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
49
50
51
52
53
54
#include <cstring>
#include 'thegerk.h'
#include <iostream>
void clean(std::string& input)
{
while(input[0] == START_PARA())
{
bool del = true;
int open = 1;
for(unsigned int i = 1; i < input.size(); i++)
{
if(input[i] == START_PARA())
open++;
else if(input[i] == END_PARA())
open--;
if(open == 0)
{
del = false;
break;
}
}
if(del)
input = input.substr(1, input.size() - 2);
else
break;
}
/*
int open = 0;
for(int i = 0; i < input.length(); i++)
{
if(input[i] == START_PARA())
open++;
else if(input[i] == END_PARA())
close--;
}
if(open == 0);
else if(open > 0)
{
if(open > 1)
{
std::cout << "Remove me for final program!\nI'm located in: void clean(std::string input)" << std::endl;
std::cout << "There is more than 1 more open paranthese then close parathese.\nThis is probably a bug." << std::endl;
std::cout << "The string in question is: " << input << std::endl;
std::cout << "Note: this is a substring of an expression and is being edited to be a workable string." << std::endl;
pause();
}
removeCharFromString(input.find_first_of(START_PARA()));
}
*/
}