As I posted some weeks ago, if you need to work with strings (or, better, character arrays) in Arduino’s C++, coming from a friendlier development environment, things reveal to be quite hard.
There are anyway two approaches that can relief the pain:
1) An F() procedure exists, moving every declared string from the highly expensive SRAM (in Arduino UNO 2kB) to flash memory (32 kB). I used this method and solved my intermitting (and making me crazy…) problems
2) Using PString library, added by NewSoftSerial and put in official version of Arduino. It is very handy: it hands you a nice object managing a char array and allowing you to modify and search your string