I want to put some weather in my system and so far its working great. I've been copying the weather stuff from the yahoo website and this is the code

             'Tomorrow Conditions
    startpoint = 0 : endpoint = 0
    _search = String.Empty : _search = "Tomorrow"
    startpoint = _response.IndexOf(_search) + 435
    endpoint = _response.IndexOf("</", startpoint)
    _tomorrow = _response.Substring(startpoint, (endpoint - startpoint)).Trim()

Now the problem I am facing is that depending on which day of the week it is sometimes some of the text is going to be missing in the begging of my words for example instead of "showers/wind" I get "/wind" because i cannot be certain that the weather condition is going to start on the 435th character.but however I am certain that it is always going to be around that area.I am certain that the weather condition is going to be after "</br>". How can i make the code to start readnig text after the "</br>" around "startpoint"

Recommended Answers

All 2 Replies

Will the description always have a slash / in it?
If so, you can use .Split() on the string and parse it by the slash rather than taking data at a given position.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.