Skip to content

Latest commit

 

History

History
27 lines (20 loc) · 676 Bytes

README.md

File metadata and controls

27 lines (20 loc) · 676 Bytes

display_width

Cross-platform single-header library to calculate the display width of UTF-8 strings.

Quick Start

#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";
}

hello_world