Then number that I have found between the square brackets I will first then put to a std::string and after this... atoi it to an int to use in a calculation.
The first thing I might wonder is then to find Number2[?] in the .txt file that I ifstream.
The problem I think of is that I am serching for the whole "Number2[?] but don´t know what is in between the brackets. Perheps I have to in someway search for a
substr(0, rfind("[")+1) that is equal to "Number2" and then put this to a string and then substring that to find the number. Am I thinking right.
I suppose I will read each line and put it to a "string" and search this string for substr Number2 in anyway.
I am not really sure how to exactly practically begin how to do.
The first goal should be to just find that number inside the brackets.
I think it could be done if I put the whole line '\n' into a string and then put the startindex to this and then continue find the number.
Is this the way it could be done ?
Thanks.
Line.substr(Line.rfind("Number2"))
Its pretty easy to extract the number between the square brackets, but why? put the number in a std::string ?
std::string has a replace() method that you can use to replace one substring with another.