C ++: equivalent to Chr () and unichr ()?

I could swear that I used the function chr()40 minutes ago, but I cannot find the file. I know that it can go up to 256, so I use this:

std::string chars = "";
chars += (char) 42; //etc

So good, but I really want to access Unicode characters. Can I do (w_char) 512? Or maybe something like a function unichr()in python, I just can't find a way to access any of these characters.

+3
source share
2 answers

The Unicode character type is probably wchar_tin your compiler. In addition, you will want to use std::wstringto place a wide line.

std::wstring chars = L"";
chars += (wchar_t) 442; //etc
+4
source

, "x" - , ? L'x ' .

, , (wchar_t) 1004. wchar_t 16- ( Visual Studio) 32- ( GCC). ++ 0x char16_t char32_t, std:: u16string.

+2

Source: https://habr.com/ru/post/1747788/


All Articles