TICKIT_UTF8_MBSWIDTH(3)

πŸ’– TICKIT_UTF8_MBSWIDTH πŸ’–

okay bestie, welcome to the TICKIT_UTF8_MBSWIDTH(3) page β€” that's the library functions manual section, and yes we are in it. this whole page is about three little functions that count the column width of a Unicode string. no cap, that's the vibe. πŸŽ€


✨ NAME ✨

tickit_utf8_mbswidth, tickit_utf8_byte2col, tickit_utf8_col2byte β€” count the column width of a Unicode string


🌈 SYNOPSIS 🌈

#include <tickit.h>

int tickit_utf8_mbswidth(const char *str);

int tickit_utf8_byte2col(const char *str, size_t byte);
size_t tickit_utf8_col2byte(const char *str, int col );

Link with -ltickit.


πŸ¦‹ DESCRIPTION πŸ¦‹

so these functions are basically a little friend group of shortcut wrappers around tickit_utf8_count(3). they each do one single simple counting operation on a string you hand them. lowkey iconic of them.

but bestie, listen β€” if you're gonna do multiple operations on the same string, it's more efficient to just use tickit_utf8_count() directly. fr fr. don't do the wrapper thing over and over, it's giving extra work. πŸ’…
  • tickit_utf8_mbswidth() β€” returns the number of columns wide that the given Unicode string consumes. how much horizontal room is this string taking up, basically. πŸ‘‘
  • tickit_utf8_byte2col() and tickit_utf8_col2byte() β€” these two convert between byte indexes and column indexes within a given string. you give one, they hand you the other. mutual bestie behaviour honestly. 🫢

🌸 RETURN VALUE 🌸

tickit_utf8_mbswidth() and tickit_utf8_byte2col() return an integer column count.

tickit_utf8_col2byte() returns an integer byte count.

that's it. that's the whole return situation. slay. ✨


πŸ’œ SEE ALSO πŸ’œ


and that's the page, bestie!! go forth and count your columns responsibly. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…

mwah πŸ’‹ β€” this was TICKIT_UTF8_MBSWIDTH(3), from the Library Functions Manual. take care of her, she's doing her best. 🫢