119 lines
2.8 KiB
C
119 lines
2.8 KiB
C
#ifndef ASCII_LIB_H
|
|
#define ASCII_LIB_H
|
|
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include "typedef.h"
|
|
|
|
|
|
/* --------------------------------------------------------------------------*/
|
|
/**
|
|
* @brief 字母a-z转换为A-Z
|
|
*
|
|
* @param buf
|
|
* @param len
|
|
*/
|
|
/* ----------------------------------------------------------------------------*/
|
|
void ASCII_ToLower(void *buf, u32 len);
|
|
|
|
/* --------------------------------------------------------------------------*/
|
|
/**
|
|
* @brief 字母A-Z转换为a-z
|
|
*
|
|
* @param buf
|
|
* @param len
|
|
*/
|
|
/* ----------------------------------------------------------------------------*/
|
|
void ASCII_ToUpper(void *buf, u32 len);
|
|
|
|
|
|
/* --------------------------------------------------------------------------*/
|
|
/**
|
|
* @brief 字符串匹配,文件名可以使用?来匹配
|
|
*
|
|
* @param src
|
|
* @param dst
|
|
* @param len
|
|
*
|
|
* @return 不匹配长度,0表示全匹配
|
|
*/
|
|
/* ----------------------------------------------------------------------------*/
|
|
u32 ASCII_StrCmp(const char *src, const char *dst, u32 len);
|
|
|
|
/* --------------------------------------------------------------------------*/
|
|
/**
|
|
* @brief 字符串匹配,不区分大小写(不能使用?来匹配)
|
|
*
|
|
* @param src
|
|
* @param dst
|
|
* @param len
|
|
*
|
|
* @return 长度(单位:byte)
|
|
*/
|
|
/* ----------------------------------------------------------------------------*/
|
|
int ASCII_StrCmpNoCase(const char *src, const char *dst, int len);
|
|
|
|
|
|
/* --------------------------------------------------------------------------*/
|
|
/**
|
|
* @brief int转string
|
|
*
|
|
* @param pStr
|
|
* @param intNum
|
|
* @param strLen
|
|
* @param bufLen
|
|
*/
|
|
/* ----------------------------------------------------------------------------*/
|
|
void ASCII_IntToStr(void *pStr, u32 intNum, u32 strLen, u32 bufLen);
|
|
|
|
|
|
/* --------------------------------------------------------------------------*/
|
|
/**
|
|
* @brief string转int
|
|
*
|
|
* @param pStr
|
|
* @param pRint
|
|
* @param strLen
|
|
*
|
|
* @return 长度(单位:byte)
|
|
*/
|
|
/* ----------------------------------------------------------------------------*/
|
|
u32 ASCII_StrToInt(const void *pStr, u32 *pRint, u32 strLen);
|
|
|
|
|
|
u32 ASCII_StrToHex(const char *pStr);
|
|
/* --------------------------------------------------------------------------*/
|
|
/**
|
|
* @brief 字符串长度 (0表示结束符)
|
|
*
|
|
* @param str
|
|
* @param len
|
|
*
|
|
* @return 长度(单位:byte)
|
|
*/
|
|
/* ----------------------------------------------------------------------------*/
|
|
u32 ASCII_StrLen(void *str, u32 len);
|
|
|
|
|
|
/* --------------------------------------------------------------------------*/
|
|
/**
|
|
* @brief 双字符串长度 (00表示结束符)
|
|
*
|
|
* @param str
|
|
* @param len
|
|
*
|
|
* @return 长度(单位:byte)
|
|
*/
|
|
/* ----------------------------------------------------------------------------*/
|
|
u32 ASCII_WStrLen(void *str, u32 len);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|