Cross-platform single-header library to calculate the display width of UTF-8 strings.
#include <unicode/display_width.hpp>
int main() {
const std::string input = u8"Hello, world!";
// Calculate display width
const auto result = unicode::display_width(input);
// Verify result
std::cout << "Input : " << input << "\n";
std::cout << "Output : " << std::string(result, '|') << "\n";
std::cout << "Width : " << result << "\n\n";
}