I really need your help with how to code this:
I have a file2
text file that contains number ranges that look like this:
12345678[5-8][0-9]
3684567150
329465207[023456789]
132478026[13]
778941351[02-689]
84364575[89][0-9]
88229401XX
981024833X
8912380XXX
So this number ranges break down like this:
12345678[5-8][0-9]: 1234567850-1234567889
3684567150: 3684567150
329465207[023456789]: 3294652070 and 3294652072-3294652079
132478026[13]: 1324780261 and 1324780263
778941351[02-689]: 7789413510, 7789413512-7789413516, 7789413518 and 7789413519
84364575[89][0-9]: 8436457580-8436457599
88229401XX: 8822940100-8822940199
981024833X: 9810248330-9810248339
8912380XXX: 8912380000-8912380999
Where the X
can take values from 0 to 9
. All these numbers are 10 digits. But the ranges may vary a lot sometimes, ranges that can be written as: [02-9]
are written as: [023456789]
and vice-versa.
I just need this part on how to read this as number ranges or maybe define cases like:
XXXXXXXXX[X-X]
XXXXXXXX[X-X][X-X]
XXXXXXXXX[XX-X]
XXXXXXXXX[XXXXXXXX]
etc. But don't have an idea on how to do that, I hope you can help me. Right now I just save the data from the file into a string vector:
ifstream file2("file2.txt");
while (getline(file2,line) && line.size()>=0)
vfile2.push_back(line);
Please don't leave alone I don't know how to even start, I've done more code for this but it has nothing to do with this part because it's not only that what the whole program is supposed to do if you need evidence to let me know.
Thank you!
UPDATED:
I have a file2
text file that contains number ranges that look like this:
88229401XX
981024833X
8912380XXX
So this number ranges break down like this:
88229401XX: 8822940100-8822940199
981024833X: 9810248330-9810248339
8912380XXX: 8912380000-8912380999
Thank you again for your help and time, I'm paralel working on this, if I figure it out (I might have some idea on how to) it will be posted inmediatly.