⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 string.h

📁 基于sip协议的网络电话源码
💻 H
📖 第 1 页 / 共 2 页
字号:
 * @param len	    The maximum number of characters to compare. * * @return  *	- < 0 if str1 is less than str2 *      - 0   if str1 is identical to str2 *      - > 0 if str1 is greater than str2 */PJ_IDECL(int) pj_strncmp2( const pj_str_t *str1, const char *str2, 			   pj_size_t len);/** * Perform lowercase comparison to the strings. * * @param str1	    The string to compare. * @param str2	    The string to compare. * * @return  *	- < 0 if str1 is less than str2 *      - 0   if str1 is equal to str2 *      - > 0 if str1 is greater than str2 */PJ_IDECL(int) pj_stricmp(const pj_str_t *str1, const pj_str_t *str2);/** * Perform lowercase comparison to the strings which consists of only * alnum characters. More over, it will only return non-zero if both * strings are not equal, not the usual negative or positive value. * * If non-alnum inputs are given, then the function may mistakenly  * treat two strings as equal. * * @param str1	    The string to compare. * @param str2	    The string to compare. * @param len	    The length to compare. * * @return  *      - 0	    if str1 is equal to str2 *      - (-1)	    if not equal. */#if defined(PJ_HAS_STRICMP_ALNUM) && PJ_HAS_STRICMP_ALNUM!=0PJ_IDECL(int) strnicmp_alnum(const char *str1, const char *str2,			     int len);#else#define strnicmp_alnum	pj_ansi_strnicmp#endif/** * Perform lowercase comparison to the strings which consists of only * alnum characters. More over, it will only return non-zero if both * strings are not equal, not the usual negative or positive value. * * If non-alnum inputs are given, then the function may mistakenly  * treat two strings as equal. * * @param str1	    The string to compare. * @param str2	    The string to compare. * * @return  *      - 0	    if str1 is equal to str2 *      - (-1)	    if not equal. */#if defined(PJ_HAS_STRICMP_ALNUM) && PJ_HAS_STRICMP_ALNUM!=0PJ_IDECL(int) pj_stricmp_alnum(const pj_str_t *str1, const pj_str_t *str2);#else#define pj_stricmp_alnum    pj_stricmp#endif/** * Perform lowercase comparison to the strings. * * @param str1	    The string to compare. * @param str2	    The string to compare. * * @return  *	- < 0 if str1 is less than str2 *      - 0   if str1 is identical to str2 *      - > 0 if str1 is greater than str2 */PJ_IDECL(int) pj_stricmp2( const pj_str_t *str1, const char *str2);/** * Perform lowercase comparison to the strings. * * @param str1	    The string to compare. * @param str2	    The string to compare. * @param len	    The maximum number of characters to compare. * * @return  *	- < 0 if str1 is less than str2 *      - 0   if str1 is identical to str2 *      - > 0 if str1 is greater than str2 */PJ_IDECL(int) pj_strnicmp( const pj_str_t *str1, const pj_str_t *str2, 			   pj_size_t len);/** * Perform lowercase comparison to the strings. * * @param str1	    The string to compare. * @param str2	    The string to compare. * @param len	    The maximum number of characters to compare. * * @return  *	- < 0 if str1 is less than str2 *      - 0   if str1 is identical to str2 *      - > 0 if str1 is greater than str2 */PJ_IDECL(int) pj_strnicmp2( const pj_str_t *str1, const char *str2, 			    pj_size_t len);/** * Concatenate strings. * * @param dst	    The destination string. * @param src	    The source string. */PJ_IDECL(void) pj_strcat(pj_str_t *dst, const pj_str_t *src);/** * Concatenate strings. * * @param dst	    The destination string. * @param src	    The source string. */PJ_IDECL(void) pj_strcat2(pj_str_t *dst, const char *src);/** * Finds a character in a string. * * @param str	    The string. * @param chr	    The character to find. * * @return the pointer to first character found, or NULL. */PJ_INLINE(char*) pj_strchr( const pj_str_t *str, int chr){    return (char*) memchr((char*)str->ptr, chr, str->slen);}/** * Remove (trim) leading whitespaces from the string. * * @param str	    The string. * * @return the string. */PJ_DECL(pj_str_t*) pj_strltrim( pj_str_t *str );/** * Remove (trim) the trailing whitespaces from the string. * * @param str	    The string. * * @return the string. */PJ_DECL(pj_str_t*) pj_strrtrim( pj_str_t *str );/** * Remove (trim) leading and trailing whitespaces from the string. * * @param str	    The string. * * @return the string. */PJ_IDECL(pj_str_t*) pj_strtrim( pj_str_t *str );/** * Initialize the buffer with some random string. * * @param str	    the string to store the result. * @param length    the length of the random string to generate. * * @return the string. */PJ_DECL(char*) pj_create_random_string(char *str, pj_size_t length);/** * Convert string to unsigned integer. * * @param str	the string. * * @return the unsigned integer. */PJ_DECL(unsigned long) pj_strtoul(const pj_str_t *str);/** * Convert strings to an unsigned long-integer value. * This function stops reading the string input either when the number * of characters has exceeded the length of the input or it has read  * the first character it cannot recognize as part of a number, that is * a character greater than or equal to base.  * * @param str	    The input string. * @param endptr    Optional pointer to receive the remainder/unparsed *		    portion of the input. * @param base	    Number base to use. * * @return the unsigned integer number. */PJ_DECL(unsigned long) pj_strtoul2(const pj_str_t *str, pj_str_t *endptr,				   unsigned base);/** * Utility to convert unsigned integer to string. Note that the * string will be NULL terminated. * * @param val	    the unsigned integer value. * @param buf	    the buffer * * @return the number of characters written */PJ_DECL(int) pj_utoa(unsigned long val, char *buf);/** * Convert unsigned integer to string with minimum digits. Note that the * string will be NULL terminated. * * @param val	    The unsigned integer value. * @param buf	    The buffer. * @param min_dig   Minimum digits to be printed, or zero to specify no *		    minimum digit. * @param pad	    The padding character to be put in front of the string *		    when the digits is less than minimum. * * @return the number of characters written. */PJ_DECL(int) pj_utoa_pad( unsigned long val, char *buf, int min_dig, int pad);/** * Fill the memory location with zero. * * @param dst	    The destination buffer. * @param size	    The number of bytes. */PJ_INLINE(void) pj_bzero(void *dst, pj_size_t size){#if defined(PJ_HAS_BZERO) && PJ_HAS_BZERO!=0    bzero(dst, size);#else    memset(dst, 0, size);#endif}/** * Fill the memory location with value. * * @param dst	    The destination buffer. * @param c	    Character to set. * @param size	    The number of characters. * * @return the value of dst. */PJ_INLINE(void*) pj_memset(void *dst, int c, pj_size_t size){    return memset(dst, c, size);}/** * Copy buffer. * * @param dst	    The destination buffer. * @param src	    The source buffer. * @param size	    The size to copy. * * @return the destination buffer. */PJ_INLINE(void*) pj_memcpy(void *dst, const void *src, pj_size_t size){    return memcpy(dst, src, size);}/** * Move memory. * * @param dst	    The destination buffer. * @param src	    The source buffer. * @param size	    The size to copy. * * @return the destination buffer. */PJ_INLINE(void*) pj_memmove(void *dst, const void *src, pj_size_t size){    return memmove(dst, src, size);}/** * Compare buffers. * * @param buf1	    The first buffer. * @param buf2	    The second buffer. * @param size	    The size to compare. * * @return negative, zero, or positive value. */PJ_INLINE(int) pj_memcmp(const void *buf1, const void *buf2, pj_size_t size){    return memcmp(buf1, buf2, size);}/** * Find character in the buffer. * * @param buf	    The buffer. * @param c	    The character to find. * @param size	    The size to check. * * @return the pointer to location where the character is found, or NULL if *         not found. */PJ_INLINE(void*) pj_memchr(const void *buf, int c, pj_size_t size){    return (void*)memchr((void*)buf, c, size);}/** * @} */#if PJ_FUNCTIONS_ARE_INLINED#  include <pj/string_i.h>#endifPJ_END_DECL#endif	/* __PJ_STRING_H__ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -