The following code shows an example where I was trying to find "dim" in a string.
For some reason the code will find "ddim" in Http_req, but will not find "dim"
To solve my problem I just changed my input data so the string contains x10cmd-dim and then search for -dim which works just fine. I just thought I'd see if someone had an answer as to why the search for "dim" doesn't work.
I am using a mega with ide 1.0.3 and the following library's.
Thanks for looking.
Mike
#include <DallasTemperature.h>
#include <Wire.h>
#include <DS1307new.h>
#include <OneWire.h>
//#include <EEPROM.h>
#include <EEPROMex.h>
#include <x10.h>
#include <x10constants.h>
#include <SdFat.h>
#include <SPI.h>
#include <Ethernet.h>
#include <SdFatUtil.h>
#include <EthernetUdp.h>
#include <string.h>
#include <Time.h>
#include "Smtp_Service.h"
}
void testcode() // /Z/ //Fx
{
char Http_req[] = "get x10cmddim,something,something";
char Http_req2[] = "get x10cmd-dim,something,something";
cout << pstr("\nSearch for dim");
if ((StrContains(Http_req, "dim"))) {cout << pstr("\nFound dim\n");} // /x10cmddim,name~,dims.
else { cout << pstr("\nDid not find dim\n"); }
cout << pstr("Search for ddim");
if ((StrContains(Http_req, "ddim"))) {cout << pstr("\nFound ddim\n");} // /x10cmddim,name~,dims.
else { cout << pstr("\nDid not find ddim\n"); }
cout << pstr("Search for -dim");
if ((StrContains(Http_req2, "-dim"))) // don't know why, but could not get search for just plane dim to work
{ cout << pstr("\nFound -dim\n"); }
else { cout << pstr("\nDid not find -dim\n"); } [left][/left]