Jump to content

[SOLVED] extracting numbers, coverting, and replacing them in a string.


funsutton

Recommended Posts

Hey, here is a separate string, similar to the other, however it has no F or C to denote the actual temperatures. How hard would it be to modify your preg_replace to only change the ones that are temps...and not the ones that are actual dates and times?

 

mpdData['HMhour'].hour['0']=new mpdHMHrObj(new Date('2008','7','31','0','0','0'),'11','Few Showers','74','74','30','69','87','From S 2 mph');

 

The trick is, in this section "'Few Showers','74','74','30','69','87','From S 2 mph'", only the 74,74,69 are temps, and the others are percents.

 

See, the thing is that there's nothing special to denote those numbers as temperatures.  I mean, you could write up a long-winded regex for every single field until you get the right ones, but I doubt you'd want to do that... @_@

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.