How to declare UTF-16 string in C++

1 Answer

0 votes
#include <iostream>     

int main () {
    std::u16string str = u"UTF-16 string";
   
    for (const auto& ch: str)
        std::cout << static_cast<char>(ch);
}
  
  
  
/*
run:
  
UTF-16 string
  
*/

 



answered Nov 26, 2022 by avibootz
...