ultrasonic distance measuring sensor

i have a ultrasonic sensor (echo pro from rhydolabz) that can measure distance and also temperature. i am using arduino uno to get the values from the sensor and the code i wrote works fine and gives output like this distance:D005.3T022C. but the problem is i want to seperate the values and show them on the serial monitor like distance: 05.3cm
temperature:22
C
anyone know how to do this??

here is the code i use to get the data
#include<SoftwareSerial.h>
SoftwareSerial myserial(2,3);
char data;
int finish=0;
int i=0;
char a[15];

void setup() {
Serial.begin(9600);
myserial.begin(9600);

}

void loop()
{
sensor();
if(finish)
{
Serial.print(“depth:”);
Serial.print(a);
Serial.println("*C");
finish=0;
i=0;
}

}

void sensor()
{
while(myserial.available()>0)
{
data= myserial.read();
if(data !=0x0D && finish==0)
{
a[i++]=data;
}
if(data==0x0D)
{
finish=1;
}
}
}

(i used myserial because i use more than 1 sensor)

gives output like this distance:D005.3T022*C

Will the values that you want to print always be in the same positions in the string and will they always be the same length ?

yes, they will. but the values might change from like D005.3T22*C to for suppose like D150.3T30*C

Nihanth: yes, they will. but the values might change from like D005.3T22*C to for suppose like D150.3T30*C

So, the string will always start with a 'D', always have a 'T' between the interesting values, always have a '*' to terminate the second interesting value, and always end with a 'C'?

Then, parsing the string, using strtok() will be trivial. Converting the tokens to floats, using atof(), is a no-brainer.

If you don't have a string, you aren't reading the data properly, and you are on your own parsing whatever it is you have.