abdul
Aug 4th, 2001, 10:10 PM
How do know if there is one or more "." in a string.
If there is any "." then I perform certain action, and If there is non then I do something else
kedaman
Aug 5th, 2001, 05:11 AM
for (char*i=string;*i;++i)
if (*i='i')
;//cetain action
else
;//something else
parksie
Aug 9th, 2001, 04:24 AM
Originally posted by kedaman
for (char*i=string;*i;++i)
if (*i='i')
;//cetain action
else
;//something else
*cough*if(*i == 'i')
Chris
Aug 11th, 2001, 09:38 AM
or using strstr function
char *Source = new char[10];
char *Search = new char[1];
char *p1=0;
char *tmp = new char[30];
strcpy(Source, "abcdef.ghi");
strcpy(Search, ".");
p1 = strstr(Source, Search);
if (p1 != NULL)
{
sprintf(tmp, "Dot found at address %ld", &p1);
MessageBox(hDlg, tmp, "Search", MB_OK);
}
else
{
MessageBox(hDlg, "No dot fuond.", "Search", MB_OK);
}