Hiya, I'm trying to retrieve a string from a html file and in a very clumsy way have almost achieved what I want to do. However I'm stumped about how to sort the retrieved data. I need to clean up the numerical value after the "clientid=". The clientid field could have characters from 1 to n and is always followed by a character like " ' ; etc. How can I check through the numerical string until I reach the end number before the ;' " etc and then store the value?
I think the best way to do this would be to search initially for the string "clientid=" and then search for the variable numerical data following it ie 7875. I don't think using string.mid is the best way of doing this
I assume I would use a while loop and if the string was clientid=7875"; the program would check 7 then 8 then 7 etc until it finds the " and then will store only the numerical value as a new string. I'm struggling with this as I am new to programming and string manipulation but I really want to learn.
Here's what I have so far:
Thankyou for taking the time to help me.
All the best Rob
I think the best way to do this would be to search initially for the string "clientid=" and then search for the variable numerical data following it ie 7875. I don't think using string.mid is the best way of doing this
I assume I would use a while loop and if the string was clientid=7875"; the program would check 7 then 8 then 7 etc until it finds the " and then will store only the numerical value as a new string. I'm struggling with this as I am new to programming and string manipulation but I really want to learn.
Here's what I have so far:
result = TextFile.ReadToString("C:\\htmlsource.txt");
clientid = String.Find(result, "clientid", 1, false);
clientid1 = String.Mid(result, clientid, 10);
clientid = String.Find(result, "clientid", 1, false);
clientid1 = String.Mid(result, clientid, 10);
All the best Rob
Comment