Question 1: Look at the code below, there is no error in compilation, but it is always False
CSTRING STR = _t (a: b ");
IF (str.find (_t (":")> = 0))
Return True;
Return False;
Look carefully, I found out that the judge of> = 0 accidentally wrote the Find () function, so the code is
CString Strtemp = (_t (':')> = 0);
IF (str.find (strtemp))
....
Due to the type conversion of C itself, it has not been able to use the code that does not work, hey, sometimes flexible is also a disaster.
Question 2: First look at the code below, still compile it to return false, pay attention to the colon is Chinese characters:
CString str = _t ("a: b");
IF (str.find (':')> = 0)))
Return True;
Return False;
General punctuation uses English characters, and the value of the English character is basically no change in different encoding, and Chinese is different. If in the Unicode environment, ':''s value also needs to indicate that the unicode character is only, so it is changed The following form:
CString str = _t ("a: b");
IF (str.find (_t (":"))> = 0)
Return True;
Return False;
CString can be the most common class, but occasionally a little small change is quite a headache:>