milsko/include/Mw/String.h

63 lines
1.3 KiB
C
Raw Permalink Normal View History

/*!
* @file Mw/String.h
* @brief String utilities
*/
#ifndef __MW_STRING_H__
#define __MW_STRING_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @brief Duplicates a string
* @param str String
* @return String
*/
2026-04-22 12:05:49 +09:00
MWDECL char* MWAPI MwStringDuplicate(const char* str);
/*!
* @brief Concatenates 2 strings
* @param str1 String
* @param str2 String
* @return String
*/
2026-04-22 12:05:49 +09:00
MWDECL char* MWAPI MwStringConcat(const char* str1, const char* str2);
/*!
* @brief Converts size to string
* @param out Output
* @param size Size
*/
2026-04-22 12:05:49 +09:00
MWDECL void MWAPI MwStringSize(char* out, MwOffset size);
/*!
* @brief Converts time to string
* @param out Output
* @param t Time
*/
2026-04-22 12:05:49 +09:00
MWDECL void MWAPI MwStringTime(char* out, time_t t);
2026-03-30 11:14:33 -07:00
/*!
* @brief Prints up to n characters into a bufferMwStringPrintIntoBuffer.
* @note On compilers that support C99, this uses vsnprintf to safely print into a buffer; on compilers that don't, vsprintf is used.
2026-03-30 11:14:33 -07:00
* @param out Buffer
* @param size Max size
*/
2026-04-22 12:05:49 +09:00
MWDECL void MWAPI MwStringPrintIntoBuffer(char* out, MwU32 size, const char* fmt, ...);
/*!
* @brief Check if the given key is UTF8
* @param key Input
* @return whether its utf8
*/
2026-04-22 12:05:49 +09:00
MWDECL MwBool MWAPI MwStringIsKeyUTF8(MwU32 key);
2026-03-30 11:14:33 -07:00
#ifdef __cplusplus
}
#endif
#endif