qlibs:(str)
π okay so this is qlibs:(str) π
bestie, welcome to the str page β it's giving allocated-string main character energy, and we're gonna go through every single function like it's a group chat β¨
β¨ NAME β¨
str β string evaluation and comparision (yes, that's the spelling in the source, she's got character π
) for allocated strings.
πΈ SYNTAX πΈ
first things first, include the header, no cap:
#include "str.h"
then the whole function lineup, exactly as she comes:
unsigned int str_copy(char *dst, const char *src);
unsigned int str_copyb(char *dst, const char *src, unsigned int len);
unsigned int str_chr(const char *s, int c);
unsigned int str_rchr(const char *s, int c);
unsigned int str_diff(const char *s, const char *t);
unsigned int str_diffn(const char *s, const char *t, unsigned int len);
unsigned int str_equal(const char *s, const char *t);
unsigned int str_len(const char *s);
unsigned int str_start(const char *dst, const char *src);
char *str_append(char *dst, const char *s);
π¦ DESCRIPTION π¦
okay so here's the tea on each one, bestie π
str_copyβ copiessrcintodstup to the first occurrance of\0while including it. It returns the number of bytes written. Ifdstis smaller thansrc,str_copyfills updstto its allocated size and returns the number of bytes it would have be written. (yep, that's the exact phrasing, no editing π)str_copybβ copieslenbytes fromsrcintodst.str_chrandstr_rchrβ searches for a single character in a string (from left-to-right or from right-to-left) and returns the position of the first occurrance ofcor the lengthlenofs.str_lenβ determines the length of a string. It returns the position of the first occurrance of\0ins.str_diff,str_diffn, andstr_equalβ compare two strings.str_diffandstr_diffnreturns negative, zero or positive, depending whether the strings[0], s[1], ..., s[n]=='\0'is ASCII lexicographically smaller than, equal to, or greater than the stringt[0], t[1], ..., t[m-1]=='\0'. If the strings are different, both functions do not read bytes past the first difference.str_diffnconsiders the strings equal if the firstncharacters match.str_equalβ returns1, ifsandtmatch up to and including the first occurrance of\0or returns0otherwise. It is the opposite ofstr_diff.str_startβ compares the two strings from the begining. It returns1iftis a prefix ofsor0otherwise. (that's literally what the page says, bestie π )*str_appendβ appends a single bytestoout, givenoutis allocated with enough space.
π NOTE π
β οΈ note tea, and this one matters: for thestr_copy*and*str_appendcommands,dsthas to have a preallocated space. Otherwise the result may be unexpected β do not play with her, bestie π
π SEE ALSO π
bye bestie! π footer tea: this is qlibs:(str), page 3, and there's no date listed β timeless icon behavior π°οΈβ¨
π¦ where this page comes from
- alpine 3.24: fehqlibs-doc 31-r0 Β· Public-Domain
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms