I have a code like:
int contains(LPCTSTR name)
{
char * data = "test.txt";
}
How can i check whether name
contains 'data'? Thanks!
Since you are using Windows and TCHAR
, a more idiomatic solution would be:
BOOL contains(LPCTSTR lpName) {
return _tcsstr(name, _T("data"));
}
Unless your data
is deliberately a char *
, in which case the answer changes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With