Is current weather condition or forecast condition returning a blank weather string for you?

  • 1
  • Idea
  • Updated 8 years ago
I can't see where it was posted now but a few days ago I read something about the weather field returning an empty string from some locations. I've experienced this problem and since it was sporadic I wrote a function for my desktop weather app that solved the issue. Using XML; when the empty string shows up I just grab the icon string and pass that to my function to parse that to an array with a regular expression then set each element to Title Case (another function) then recombine them with spaces.
Example: mostlycloudy
First grap the text between > and </
Using the expression "(?i)^(partly|mainly|mostly)(.+)$" will return
array[0] = mostly
array[1] = cloudy
so I Title Case those, add the space and the return string becomes
"Mostly Cloudy"
Hope that helps someone else with this issue.

EDIT: The forum doesn't handle XML tags in a nice manner so I had to remove the tags but I think you can still get the gist of it.
Photo of GEOSoft


  • 26 Posts
  • 1 Reply Like

Posted 8 years ago

  • 1

Be the first to post a reply!