Click here to Skip to main content
15,889,462 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi!

please suggest below problem.

CString str1 = "/\?<>|:*"; //contains only these letters
CString str2 = "CodeProject@25_Feb#2013!"; // contains no's special chars, letters

need to compare both str1 and str2. str2 should not match with any character in str1.

Thanks and Regards
Sam.
Posted

1 solution

strspn[^] is your friend.
 
Share this answer
 
Comments
SoMad 25-Feb-13 11:59am    
Or CString::FindOneOf()[^]. The name is just a little more intuitive :).

Soren Madsen
Mr Sam 25-Feb-13 12:32pm    
I did not get success by using above functions. Any other solutions please. And how to resolved this : cannot convert parameter 1 from 'CString' to 'const char *'?
PJ Arends 26-Feb-13 11:12am    
unicode / non-unicode conflict. use the the neutral _tcsspn version or the unicode wcsspn version. Or better yet, use the function suggested by SoMad.
Maximilien 25-Feb-13 13:23pm    
can you show the code you are using ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900