Re: How to change ALL comma in a CEdit into double byte comma?



Well, that's pretty easy:

CString s;
c_MyEditControl.GetWindowText(s);
if(s.Replace(_T(","), _T(" ")))
c_MyEditControl.SetWindowText(s);

I'd put this in the EN_CHANGE handler.
joe

On Wed, 11 Jun 2008 16:43:00 -0700, Landon <Landon@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

I would make sure the program is compiled to use Unicode.
Then modify the strings to contain the characters you need before adding
them to the edit controls (before call to SetWindowText())

If you need to modify it while the user is typing then you could create an
OnChar() handler to check each character as it is typed and replace it with
whatever you'd like. If you need to turn one character into two you could
just call CEdit::OnChar(...) twice from your OnChar routine (the one in the
base class).

http://support.microsoft.com/kb/92394

Tom

No, the problem is that I don't check the user input. It just to check if
the user press the comma key or there is old data which has comma and needs
to be updated, so I must check a CEdit string and change all the commas to
Kanji comma which is double bytes.

How ?
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Searching string for characters
    ... Hi, I've been experimenting some more with strings, I've written some ... code where I want to test to see if a certain character char_a is in ... The comma, full stop are no problems but it's the extra " that's ... Is it possible to get the extra double quote in my testlist or have I ...
    (comp.lang.c)
  • Re: How to change ALL comma in a CEdit into double byte comma?
    ... If you need to modify it while the user is typing then you could create an OnCharhandler to check each character as it is typed and replace it with whatever you'd like. ... If you need to turn one character into two you could just call CEdit::OnChartwice from your OnChar routine. ... If there is a comma character, I must change it into double-byte comma ...
    (microsoft.public.vc.mfc)
  • Re: Unicode Support
    ... > Not knowing much about UTF-8 (my Unicode knowledge extends as far as ... > literal strings of this form as long as the character code for quote ... > can never appear in a MBCS (multibyte character sequence). ... then XP Notepad directly understands UNICODE and you can ...
    (alt.lang.asm)
  • Re: Need help on string manipulation
    ... better to convert strings to UCS-32 before manipulation? ... Characters represented by wchar_t must use one wchar_t per character, ... which may use a multibyte encoding. ... use some newer Unicode characters, if this is a problem for you, then ...
    (comp.lang.c)
  • Re: Copying string to byte array
    ... of Strings and the CryptEncrypt + CryptDecrypt APIs. ... binary data should not be held in String variables. ... a) not all character codes are valid in a given ...
    (microsoft.public.vb.general.discussion)