-
Notifications
You must be signed in to change notification settings - Fork 1
/
text_parser.cpp
64 lines (57 loc) · 1.36 KB
/
text_parser.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
55
56
57
58
59
60
61
62
63
64
#include <iostream>
#include <fstream>
#include <cstring>
/*
void removeDupWord(std::string str)
{
// Used to split string around spaces.
std::istringstream ss(str);
// Traverse through all words
do {
// Read a word
std::string word;
ss >> word;
// Print the read word
std::cout << word << std::endl;
// While there is more to read
} while (ss);
}*/
std::string removeDupWord(std::string str)
{
std::string word = "";
for (auto x : str)
{
if (x == ' ')
{
std::cout << word << std::endl;
word = "";
}
else
{
word = word + x;
}
}
std::cout << word << std::endl;
return word;
}
int main() {
std::ifstream control_fd("./data/Control_oligos(-)38lines.txt");
std::string probe_no;
std::string probe_name;
std::string seq;
getline(control_fd,probe_no);
while(control_fd) {
//getline(control_fd,probe_no);
getline(control_fd,probe_no);
//getline(control_fd, probe_name,' ');
//getline(control_fd,seq,'\n');
//seq = removeDupWord(probe_no);
seq = probe_no.substr(75,61);
//std::cout<<probe_no<<std::endl;
std::cout<<seq<<std::endl;
//std::cout<<"seq "<<seq<<"\nProbe_no "<<probe_no<<"\n Probe name "<<probe_name<<std::endl;
//break;
}
control_fd.close();
return 0;
}