Failed to search a character using CString::Find

Avinash Bansod 21 Reputation points
2022-12-06T10:43:41.333+00:00

Hi,

I want to find if the character ':' is present in a Chinese string "1.00 单位:14.30 单位".

But it is returning me -1 all the time though the character ':' is present in the above string.

CString myString = _T( "1.00 单位:14.30 单位");
int index = myString.Find(':');

Here I am expecting the 'index' value to be 7 but getting as -1.

Thanks in advance for any suggestion or help.

Developer technologies | C++
Developer technologies | C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
{count} votes

Answer accepted by question author
  1. David Lowndes 4,726 Reputation points
    2022-12-06T11:34:53.857+00:00

    Your character isn't a ':', it's ':'

    Try:
    int index = myString.Find( _T(':') );


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.