Extracting data from text strings

I'm new to Arduino, recently picked up an RFduino, Arduino Uno, and a GPRS Seeeduino shield. I'm working with the Seeeduino right now to read text strings and act accordingly. IE: I want to text my device and make it do something. For this I need to chop down the SMS text to get just the guts of the message. I've looked into the reference pages on the String Trim/Length functions but neither seem to be what I'm looking for. I'm familiar with Visual Basic programming where I can easily use mid/last functions to get what I need. Is there something simple in Arduino that I'm missing?

Guidance is appreciated!

Thanks, Justin

Avoid string classes because they have issues. You will need to learn to use traditional c-style arrays of char. If you want functions like visual basic, you will need to implement them yourself, or I am sure somehow has done so already if you look around.

Post a few sample messages so we know the format.

The Strings object has an indexOf() function and substring() functions to allow for parsing of strings and breaking them up into their various parts. I built a standardised ExtractNextDelimitedField() function to parse comma, tab and other delimited strings into their field-by-field parts.

Ignore adverse comments about the Strings object - past problems have been fixed and the Strings class now works correctly just like in other languages.

That said you would be wise to understand and manage your use of the Strings class and the effect of concatenating multiple fields into one long string - and vice-versa - stripping individual fields off a string that gets shorter and shorten until you have processed all the fields. These operations can fragment heap memory but my application experience is that free heap memory is managed well enough and does not get increasingly fragmented the longer your application runs.

My 5,000 line application has been running for 2 days and 19 hours and only uses Strings (maybe a hundred spread through 100 procedures). Right now free heap is 562 bytes containing these four blocks of memory - 445,93,19,5. The 445 byte block is likely not to have anything to do with String usage - it will be related to an ethernet client or SD card file object release. But the 19 and 5 byte blocks were probably caused by a String operation and will be re-used or released by the heap manager when it can.

Catweazle NZ

Below is a link to the textfinder application that might be useful. Bottom is a discussion with code for parsing xml.

http://playground.arduino.cc/Code/TextFinder

http://forum.arduino.cc/index.php/topic,39023.0.html

Ignore adverse comments about the Strings object - past problems have been fixed and the Strings class now works correctly just like in other languages.

Sure, as long as you use it on the Arduino only after you replace that 2K SRAM with 2G of SRAM.

Ignore the idiots that think that the String crutch is the only way to deal with strings.

liudr: Post a few sample messages so we know the format.

Example string: AT+CMGR: "REC UNREAD"+19206483234", ,"13/12/08,20:40:31+00" Test Message

The last part, the actual message content, is what I'm looking to extract. Slowly making my way through the muddy waters of a new programming language. I will take a look at the textfinder app today.