All strung out...help getting started

Hi All,

I am just starting out and would REALLY appreciate a push in the right direction. Looking at lots of other posts I know better that to expect someone to write this for me, but a little more than "see strcpy or setCharAt" would be nice :+)

I need to take an in-coming string like this for example: ABCD 1 a0:c1:00:e2:b5:23 19 DCBA \r

Then take "this part" out: a0:c1:00:e2:b5:23

Put "this part" in a new string and send it back: BUZZ 3 a0:c1:00:e2:b5:23 17 ZZUB \r

Thank you in advance, Geno

Assuming the substring to be returned is always the same length and always starts in the same place, it seems to me a “for” loop would do the job.

Serial.print ("BUZZ 3 ");
for (int i = 0; i < SUB_LEN; ++i) {
  Serial.print (inBuffer [i + SUB_OFFSET]);
}
Serial.println (" ZZUB ");

String operations:

http://arduino.cc/en/Reference/StringObject http://www.arduino.cc/en/Tutorial/TextString

You need to also explain how this string works so we can explain better. Will it be fixed length(as AWOL assumed)? It seems to be a MAC address. So I guess a0:c1:00:e2:b5:23 will have the same length. But what about ABCD, 1, 19 and DCBA? Will it always be ABCD and DCBA? Will values for 1 and 19 vary? Same for BUZZ, 3, 17 and ZZUB.

Thanks you all for the replies.

AWOL nailed it and we have a script working fine for this. Thank you again!

And Antzy, yes the string will always be the same length with the only variable being the address in the middle.

Really appreciated the replies. Best regards, Geno