开发者

C++ Unicode Bullet Point

I am trying to insert the Unicode character U+2022 (bullet ) in my C++ application.

I can't figure out how to convert that U+2022 to a char/string for use in std::string constructor...

char bullet = char(0x2022);
mPassword.SetText( std::string(mText.length(), bullet) );

This one doesn't w开发者_如何学编程ork. Hope you can help !!

Thanks

opatut


Unicode character has type wchar_t(see §2.13.4 of the C++ Standard). You could use it as follows:

wchar_t bullet = L'\x2022';

In string it will look like:

std::wstring str_w_bullet( L"some text with \x2022" );


use std::wstring which is that same as std::string but specialized on wchar_t

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜