Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/p-ranav/unicode_display_width

Displayed width of UTF-8 strings in Modern C++
https://github.com/p-ranav/unicode_display_width

aligned-text alignment cpp11 display display-width length single-header single-header-lib unicode utf8

Last synced: 3 days ago
JSON representation

Displayed width of UTF-8 strings in Modern C++

Awesome Lists containing this project

README

        


display_width

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

## Quick Start

```cpp
#include

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