Isolating a part of a string returned by a serial port


i using esp8266 retrieve current date , time web server

code: [select]

string response = "";         
     
while(wifi.available())
{
   char c = wifi.read(); // read next character.
   response+=c;

   
serial.print(response);   


this prints following hardware serial
code: [select]

+ipd,0,637:http/1.1 200 ok
content-type: text/html; charset=utf-8
connection: close
status: 200 ok
x-frame-options: allowall
access-control-allow-origin: *
access-control-allow-methods: get, post, put, options, delete, patch
access-control-allow-headers: origin, content-type, x-requested-with
access-control-max-age: 1800
etag: "6618644d86bb40f12eefc8f3f59cd42e"
cache-control: max-age=0, private, must-revalidate
x-request-id: 54474c64-10bc-4dc6-9bc4-4d893915a6eb
x-runtime: 0.095279
x-powered-by: phusion passenger 4.0.57
date: sun, 01 nov 2015 17:54:56 gmt
server: nginx/1.9.3 + phusion passenger 4.0.57

sun, 01/11/2015, 17:54
ok



i cant use substring on string , trying work out way can pull out date , time information. this.
code: [select]
sun, 01/11/2015, 17:54

any appreciated.

if familiar c strings, try strstr() locate substring "date: "

one have pointer there ought able tokenize string using strtok() chars tokenize date looking for.




Arduino Forum > Using Arduino > Programming Questions > Isolating a part of a string returned by a serial port


arduino

Comments