Problems processing multi line SMS

Hello.

I am having difficulty “processing” multi line SMS messages with arduino.

I am trying to receive a SMS from a device, containing time/GPS location etc. and process this information to perform further tasks.

There is no problem achieving this with “single line messages”. Examples and details below.

Hardware

Arduino Mega
Spark Fun Cellular Shield, SM5100b
Suitable power supply

Code

The “usual” but reliable:

if (cell.ReceiveSMS() && messageReceived == false) {
messageReceived==true;
digitalWrite(readyLed,LOW);
digitalWrite(SMSLed,HIGH);
senderArray = cell.Sender();
messageCompare = cell.Message();
cell.DeleteAllSMS();
messageCompare.toLowerCase();
access=0;

etc.

Notes:

messageCompare is a String used to compare part or all of the message received

Problem:

I received a message: time: 16:05 18FEB2015 Lat: xx.xxxx Lon: xx.xxxx

Serial displays: time: 16:05 18FEB2015 Lat: xx.xxxx Long: xx.xxxx
AT+CMGD=1,4

And, String messageCompare has a value of time: 16:05 18FEB2015 Lat: xx.xxxx Long: xx.xxxx

BUT: my device sends this SMS:

time: 16:05 18FEB2015
lat: xx.xxxxx
lon: xx.xxxx

Serial displays: 16:05 18FEB2015
AT + CMGD=1,4
lat: xx.xxxxx
lon: xx.xxxxx

String messageCompare has a value of 16:05 18FEB2015 so I can only play with this information, and “miss” the lat/lon which is really what I need.

I apologise for my insolence if I have missed a previous solution on the forum, and have solved all previous issues while learning to write code by reading the forums.

Any advice would be greatly appreciated.

Best regards,
Mark

The "usual" but reliable:

if (cell.ReceiveSMS() && messageReceived == false) { messageReceived==true;

Usual nonsense that can hardly be considered reliable.

== is for testing equality. There is no point in doing that if you don't care about the result.

Any advice would be greatly appreciated.

Somehow, I doubt the sincerity of that statement, but I'll still advise you to take your snippets to http://snippets-r-us.com.

Thanks for your advice, excellent, thankyou.