Arduino join multiple strings and numbers and then seperate them OK, I'm working on a remote controlled robot. Both the robot and the remote use Arduino with a Bluetooth shield. The Bluetooth is working and I need to send something similar to this over Bluetooth:

X:1026,Y:1026,Button:1

There may be more buttons added and X,Y can be between 1026 and 0. How can I build that string from:

xPosition = 1026;
 yPosition = 1026;
 buttonState = 0;

I also need to be able to separate that string back into variables on the 2nd Arduino. 

EDIT: I have seen other questions similar to this but they involved Serial. I am using Bluetooth. 

EDIT AGAIN: I am sending the data over Bluetooth with the BlueToothSerial.print command from the SoftwareSerial.h library. (BlueToothSerial is SoftwareSerial BlueToothSerial(RxD,TxD);)
To make the string you can:

char outstring[30];
sprintf(outstring, "X:%d,Y:%d,Button:%d", xPosition, yPosition, buttonState);


Be sure to make the outstring big enough to store it all.

That is, of course, if you actually need to have the whole thing in one string all the time.  You haven't said how you are sending it (yes, I know, bluetooth, but there is bluetooth and there is bluetooth, and there are different ways of it working.)

Splitting a string like that can be done with strtok() then looking for the location of the colon in each returned token. Or, depending on how the string data actually arrives, could be parsed on a character-by-character basis, which would be better. Again, because you haven't told us how the data is actually being transferred it's impossible to elaborate on that.