include/Zycore/Format.h(3)
π include/Zycore/Format.h π
okay bestie, welcome to the Library Functions Manual page for include/Zycore/Format.h, and ngl this one is a total glow-up for number-to-string conversions. it's literally giving "make numbers pretty, but fast". let's get into it π
β¨ NAME β¨
include/Zycore/Format.h β no cap, that's the whole name, she's lowkey mysterious like that π¦
πΈ SYNOPSIS πΈ
first up, the includes you gotta pull in, periodt:
#include <Zycore/Status.h>
#include <Zycore/String.h>
#include <Zycore/Types.h>
π«Ά Functions π«Ά
here's the whole squad, and yes we're listing every single one because we are not skipping anybody:
ZYAN_INLINE ZyanU64 ZyanAbsI64 (ZyanI64 x)
ZYCORE_EXPORT ZyanStatus ZyanStringInsertFormat (ZyanString *string,
ZyanUSize index, const char *format,...)
ZYCORE_EXPORT ZyanStatus ZyanStringInsertDecU (ZyanString *string,
ZyanUSize index, ZyanU64 value, ZyanU8 padding_length)
ZYCORE_EXPORT ZyanStatus ZyanStringInsertDecS (ZyanString *string,
ZyanUSize index, ZyanI64 value, ZyanU8 padding_length, ZyanBool
force_sign, const ZyanString *prefix)
ZYCORE_EXPORT ZyanStatus ZyanStringInsertHexU (ZyanString *string,
ZyanUSize index, ZyanU64 value, ZyanU8 padding_length, ZyanBool
uppercase)
ZYCORE_EXPORT ZyanStatus ZyanStringInsertHexS (ZyanString *string,
ZyanUSize index, ZyanI64 value, ZyanU8 padding_length, ZyanBool
uppercase, ZyanBool force_sign, const ZyanString *prefix)
ZYCORE_EXPORT ZYAN_REQUIRES_LIBC ZyanStatus ZyanStringAppendFormat
(ZyanString *string, const char *format,...)
ZYCORE_EXPORT ZyanStatus ZyanStringAppendDecU (ZyanString *string,
ZyanU64 value, ZyanU8 padding_length)
ZYCORE_EXPORT ZyanStatus ZyanStringAppendDecS (ZyanString *string,
ZyanI64 value, ZyanU8 padding_length, ZyanBool force_sign, const
ZyanStringView *prefix)
ZYCORE_EXPORT ZyanStatus ZyanStringAppendHexU (ZyanString *string,
ZyanU64 value, ZyanU8 padding_length, ZyanBool uppercase)
ZYCORE_EXPORT ZyanStatus ZyanStringAppendHexS (ZyanString *string,
ZyanI64 value, ZyanU8 padding_length, ZyanBool uppercase, ZyanBool
force_sign, const ZyanStringView *prefix)
π§ Detailed Description π§
she provides helper functions for performant number to string conversion. that's it, that's the vibe β fast, glam, functional π
π Function Documentation π
π ZYAN_INLINE ZyanU64 ZyanAbsI64 (ZyanI64 x)
get the absolute value of a 64 bit int. bestie said "no negativity allowed" πβ¨
Parameters
xβ the value to process.
Returns
- the absolute, unsigned value.
also this one gracefully deals with the special case of x being INT_MAX β she's polite like that π
π ZYCORE_EXPORT ZyanStatus ZyanStringAppendDecS (ZyanString * string, ZyanI64 value, ZyanU8 padding_length, ZyanBool force_sign, const ZyanStringView * prefix)
formats the given signed ordinal value to its decimal text-representation and appends it to the string. signed decimals, appending, main character energy π
Parameters
stringβ a pointer to theZyanStringinstance.valueβ the value.padding_lengthβ padds the converted value with leading zeros, if the number of chars is less than thepadding_length.force_signβ setZYAN_TRUE, to force printing of the+sign for positive numbers.prefixβ the string to use as prefix orZYAN_NULL, if not needed.
Returns
- a zyan status code.
β οΈ this function will fail if theZYAN_STRING_IS_IMMUTABLEflag is set for the specifiedZyanStringinstance. immutable means immutable, bestie, no exceptions π
π ZYCORE_EXPORT ZyanStatus ZyanStringAppendDecU (ZyanString * string, ZyanU64 value, ZyanU8 padding_length)
formats the given unsigned ordinal value to its decimal text-representation and appends it to the string. no minus sign in sight, we love a positive queen πΈ
Parameters
stringβ a pointer to theZyanStringinstance.valueβ the value.padding_lengthβ padds the converted value with leading zeros, if the number of chars is less than thepadding_length.
Returns
- a zyan status code.
β οΈ this function will fail if theZYAN_STRING_IS_IMMUTABLEflag is set for the specifiedZyanStringinstance. don't fight it π«Ά
π ZYCORE_EXPORT ZYAN_REQUIRES_LIBC ZyanStatus ZyanStringAppendFormat (ZyanString * string, const char * format, ...)
appends formatted text to the destination string. yes it's ZYAN_REQUIRES_LIBC, so keep that in mind, she's got dependencies π
Parameters
stringβ the destination string.formatβ the format string....β the format arguments.
Returns
- a zyan status code.
β οΈ this function will fail if theZYAN_STRING_IS_IMMUTABLEflag is set for the specifiedZyanStringinstance. periodt.
π ZYCORE_EXPORT ZyanStatus ZyanStringAppendHexS (ZyanString * string, ZyanI64 value, ZyanU8 padding_length, ZyanBool uppercase, ZyanBool force_sign, const ZyanStringView * prefix)
formats the given signed ordinal value to its hexadecimal text-representation and appends it to the string. hex + signed + appending = the holy trinity β¨
Parameters
stringβ a pointer to theZyanStringinstance.valueβ the value.padding_lengthβ padds the converted value with leading zeros, if the number of chars is less than thepadding_length.uppercaseβ setZYAN_TRUEto use uppercase letters ('A'-'F') instead of lowercase ones ('a'-'f').force_signβ setZYAN_TRUE, to force printing of the+sign for positive numbers.prefixβ the string to use as prefix orZYAN_NULL, if not needed.
Returns
- a zyan status code.
β οΈ this function will fail if theZYAN_STRING_IS_IMMUTABLEflag is set for the specifiedZyanStringinstance.
π ZYCORE_EXPORT ZyanStatus ZyanStringAppendHexU (ZyanString * string, ZyanU64 value, ZyanU8 padding_length, ZyanBool uppercase)
formats the given unsigned ordinal value to its hexadecimal text-representation and appends it to the string. 0xDEADBEEF girlies rise up π₯
Parameters
stringβ a pointer to theZyanStringinstance.valueβ the value.padding_lengthβ padds the converted value with leading zeros, if the number of chars is less than thepadding_length.uppercaseβ setZYAN_TRUEto use uppercase letters ('A'-'F') instead of lowercase ones ('a'-'f').
Returns
- a zyan status code.
β οΈ this function will fail if theZYAN_STRING_IS_IMMUTABLEflag is set for the specifiedZyanStringinstance.
π ZYCORE_EXPORT ZyanStatus ZyanStringInsertDecS (ZyanString * string, ZyanUSize index, ZyanI64 value, ZyanU8 padding_length, ZyanBool force_sign, const ZyanString * prefix)
formats the given signed ordinal value to its decimal text-representation and inserts it to the string. note: insert, not append β she's putting it exactly where you tell her π
Parameters
stringβ a pointer to theZyanStringinstance.indexβ the insert index.valueβ the value.padding_lengthβ padds the converted value with leading zeros, if the number of chars is less than thepadding_length.force_signβ setZYAN_TRUE, to force printing of the+sign for positive numbers.prefixβ the string to use as prefix orZYAN_NULL, if not needed.
Returns
- a zyan status code.
β οΈ this function will fail if theZYAN_STRING_IS_IMMUTABLEflag is set for the specifiedZyanStringinstance.
π ZYCORE_EXPORT ZyanStatus ZyanStringInsertDecU (ZyanString * string, ZyanUSize index, ZyanU64 value, ZyanU8 padding_length)
formats the given unsigned ordinal value to its decimal text-representation and inserts it to the string. unsigned decimals sliding in at index like they own the place π
Parameters
stringβ a pointer to theZyanStringinstance.indexβ the insert index.valueβ the value.padding_lengthβ padds the converted value with leading zeros, if the number of chars is less than thepadding_length.
Returns
- a zyan status code.
β οΈ this function will fail if theZYAN_STRING_IS_IMMUTABLEflag is set for the specifiedZyanStringinstance.
π ZYCORE_EXPORT ZyanStatus ZyanStringInsertFormat (ZyanString * string, ZyanUSize index, const char * format, ...)
inserts formatted text in the destination string at the given index. printf vibes but make it positional π
Parameters
stringβ the destination string.indexβ the insert index.formatβ the format string....β the format arguments.
Returns
- a zyan status code.
β οΈ this function will fail if theZYAN_STRING_IS_IMMUTABLEflag is set for the specifiedZyanStringinstance.
π ZYCORE_EXPORT ZyanStatus ZyanStringInsertHexS (ZyanString * string, ZyanUSize index, ZyanI64 value, ZyanU8 padding_length, ZyanBool uppercase, ZyanBool force_sign, const ZyanString * prefix)
formats the given signed ordinal value to its hexadecimal text-representation and inserts it to the string. signed hex that knows exactly where it belongs β¨
Parameters
stringβ a pointer to theZyanStringinstance.indexβ the insert index.valueβ the value.padding_lengthβ padds the converted value with leading zeros, if the number of chars is less than thepadding_length.uppercaseβ setZYAN_TRUEto use uppercase letters ('A'-'F') instead of lowercase ones ('a'-'f').force_signβ setZYAN_TRUE, to force printing of the+sign for positive numbers.prefixβ the string to use as prefix orZYAN_NULL, if not needed.
Returns
- a zyan status code.
β οΈ this function will fail if theZYAN_STRING_IS_IMMUTABLEflag is set for the specifiedZyanStringinstance.
π ZYCORE_EXPORT ZyanStatus ZyanStringInsertHexU (ZyanString * string, ZyanUSize index, ZyanU64 value, ZyanU8 padding_length, ZyanBool uppercase)
formats the given unsigned ordinal value to its hexadecimal text-representation and inserts it to the string. hex, unsigned, inserted, iconic π
Parameters
stringβ a pointer to theZyanStringinstance.indexβ the insert index.valueβ the value.padding_lengthβ padds the converted value with leading zeros, if the number of chars is less than thepadding_length.uppercaseβ setZYAN_TRUEto use uppercase letters ('A'-'F') instead of lowercase ones ('a'-'f').
Returns
- a zyan status code.
β οΈ this function will fail if theZYAN_STRING_IS_IMMUTABLEflag is set for the specifiedZyanStringinstance.
π¦ Author π¦
generated automatically by Doxygen for Zycore from the source code. doxygen did her little thing, no notes π
okay and that's the whole page!! final sign-off, mwah ππ this one came from Zycore, Version 1.5.2.0, for the page include/Zycore/Format.h(3) β slay, ate, no crumbs left, periodt ππΈ
π¦ where this page comes from
- ubuntu resolute: libzycore-doc 1.5.2-1build1 Β· MIT
- ubuntu stonking: libzycore-doc 1.5.2-1build1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms