Hey guys, im quite new to c++. i am doing a project in which i would have to extract certain information of a database which i have saved in a text file. the database looks something like this :
What i am trying to do is search each row based on a specific id and then extract the information next to it. For example, if i were to select John in the menu, the string will then search for the keyword "John32451^" and then display selected information in the text. so the information displayed here would be 23.21 and 1.24.
I am not very sure how could i do this and the method to use. Could i get some guidance? I think the best way would be to use the unique id. for example for John, the unique id before each information i want to be displayed will be "John32451^" for 23.21 and for the second set will be tdsrte^>. but how do i get it to stop at the number at not continue as you can see for 23.21 , there is a ">" after that.
1. How do you know that John in the menu = John32451? Or is that what you'd select on the menu?
2. Do the names all have 4 (John, Mark) or 9 (John32451,Mark55342) characters?
3. Is there some standard formatting to the database? Because...
1 2
John32451^23.21
Mark55342^SPACE335.11
, among others.
4. Did you write this database? Can you alter it to make it more fetch-friendly?
Sorry guys, let me show another example to make it clearer. Basically, i am downloading a html file and read it as a text file and im suppose to pull out various information based on certain id attributes.
ey guys , i am working on a simple project to extract information from a html file which i have saved. Basically, the program is suppose to extract certain information based on the certain keywords by parsing through the webpage i saved. The problem which i am having is how do i do the search and take out only the specific information?
for example, i am trying to extract information such as value and value in change , which is 2,205.29 and -60.41 respectively. The keywords would be "id="yfs_l10_^ixic">" for value and "yfs_c10_^ixic" for value in change.
So, what commands can i use to extract the information based on this keywords and how define the correct rows to extract it. I realize after each information, there is a </span>. i can use inform the prob to stop extracting the information when they read this. but what command can i do to do it. hope for some help because i have tried strtok method but it does not seem to be able to work for me
I would suggest using std::string's .find() to find what you want (or maybe find_first_of) and .substr() (to get the section of the string you want) methods.
Just to check. are we able to set delimeters in the substring? for example,
<ewdddd> 222 <2ww>
I only want it to extract the information 222 which is in between two tags? so am i able to state from where to where i would want the information to be drawn? the two tags will remain constantly the same.