Skip to content

p-ranav/unicode_display_width

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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