string.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright (c) 2006-2018, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2008-08-14 Bernard the first version
  9. */
  10. #ifndef __STRING_H__
  11. #define __STRING_H__
  12. #include <rtthread.h>
  13. #include <sys/types.h>
  14. /* replace for standard string library */
  15. #if !defined (RT_USING_NEWLIB) && defined (RT_USING_MINILIBC)
  16. #define ZEROPAD (1 << 0) /* pad with zero */
  17. #define SIGN (1 << 1) /* unsigned/signed long */
  18. #define PLUS (1 << 2) /* show plus */
  19. #define SPACE (1 << 3) /* space if plus */
  20. #define LEFT (1 << 4) /* left justified */
  21. #define SPECIAL (1 << 5) /* 0x */
  22. #define LARGE (1 << 6) /* use 'ABCDEF' instead of 'abcdef' */
  23. #define _U 0x01 /* upper */
  24. #define _L 0x02 /* lower */
  25. #define _D 0x04 /* digit */
  26. #define _C 0x08 /* cntrl */
  27. #define _P 0x10 /* punct */
  28. #define _S 0x20 /* white space (space/lf/tab) */
  29. #define _X 0x40 /* hex digit */
  30. #define _SP 0x80 /* hard space (0x20) */
  31. void* memset(void *s, int c, size_t n);
  32. void* memcpy(void *dest, const void *src, size_t n);
  33. void* memmove(void *dest, const void *src, size_t n);
  34. int memcmp(const void *s1, const void *s2, size_t n);
  35. int tolower(int c);
  36. int toupper(int c);
  37. int strcmp (const char *s1, const char *s2);
  38. int strncmp(const char *cs,const char *ct, size_t count);
  39. int strcasecmp(const char *a, const char *b);
  40. int strncasecmp(const char *cs, const char *ct, size_t count);
  41. int sscanf(const char * buf, const char * fmt, ...);
  42. size_t strlen(const char *s);
  43. char *strstr(const char * s1,const char * s2);
  44. char *strcpy(char *dest, const char *src);
  45. char *strncpy(char *dest, const char *src, size_t n);
  46. size_t strlcpy(char *dst, const char *src, size_t siz);
  47. char *strncat(char *dest, const char *src, size_t count);
  48. char *strcat(char * dest, const char * src);
  49. char *strchr(const char *s1, int i);
  50. char *strrchr(const char *t, int c);
  51. char *strdup(const char *s);
  52. char *strtok(char *s, const char *delim);
  53. char*strtok_r(char*s, const char*delim, char**ptrptr);
  54. size_t strcspn(const char *s, const char *reject);
  55. size_t strspn (const char *s, const char *accept);
  56. long strtol(const char *str, char **endptr, int base);
  57. long long strtoll(const char *str, char **endptr, int base);
  58. #endif
  59. #endif