You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
875 B

3 months ago
  1. #pragma once
  2. #include <stdarg.h>
  3. #include <stdint.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <string.h>
  7. namespace iflytop {
  8. class TJCStrUtils {
  9. private:
  10. /* data */
  11. public:
  12. /**
  13. * @brief
  14. *
  15. * @param cpyto
  16. * @param strbegin
  17. * @param maxlen
  18. * @return const char*
  19. *
  20. *
  21. * @Usage:
  22. * char input= { 1,2,3, '1','2','3','\0','1','2','3','\0','1','2','3','\0'};
  23. *
  24. * char strbuf0[20];
  25. * char strbuf1[20];
  26. * char strbuf2[20];
  27. *
  28. * const char* strbegin = &input[3];
  29. * strbegin = TJCStrUtils::cpystr(strbuf0, strbegin, sizeof(strbuf0));
  30. * strbegin = TJCStrUtils::cpystr(strbuf1, strbegin, sizeof(strbuf1));
  31. * strbegin = TJCStrUtils::cpystr(strbuf2, strbegin, sizeof(strbuf2));
  32. *
  33. */
  34. static const char* cpystr(char* cpyto, const char* strbegin, int32_t maxlen);
  35. };
  36. } // namespace iflytop