string.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. /*
  2. filesummary.CH: 提供字符串操作函数
  3. filesummary.EN: Provide string operations
  4. CH: 复制字符串
  5. EN: Copy string
  6. dst.CH: 目的字符串
  7. dst.EN: Dest string
  8. src.CH: 源字符串
  9. src.EN: Source string
  10. */
  11. void strcpy(char *dst, char *src);
  12. /*
  13. CH: 复制字符串
  14. EN: Copy string
  15. dst.CH: 目的字符串
  16. dst.EN: Dest string
  17. src.CH: 源字符串
  18. src.EN: Source string
  19. n.CH: 拷贝的长度
  20. n.EN: The length of the string
  21. */
  22. void strncpy(char *dst, char *src, int n);
  23. /*
  24. CH: 计算两个字符串的标准差值(注意:等于0表示字符串一致,而非等于布尔值true)
  25. EN: Compare the given string (Notice: Return 0 indicate same)
  26. lhs.CH: 字符串1
  27. lhs.EN: String 1
  28. rhs.CH: 字符串2
  29. lhs.EN: String 2
  30. */
  31. int strcmp(char *lhs, char *rhs);
  32. /*
  33. CH: 计算两个字符串的标准差值(注意:等于0表示字符串一致,而非等于布尔值true)
  34. EN: Compare the given string (Notice: Return 0 indicate same)
  35. lhs.CH: 字符串1
  36. lhs.EN: String 1
  37. rhs.CH: 字符串2
  38. lhs.EN: String 2
  39. n.CH: 对比的长度
  40. n.EN: The length of the string
  41. */
  42. int strncmp(char *lhs, char *rhs, int n);
  43. /*
  44. CH: 把 src 所指向的字符串追加到 dest 所指向的字符串的结尾 (dest += src)
  45. EN: Add src to the end of dest (dest += src)
  46. dest.CH: 字符串dest
  47. dest.EN: String dest
  48. src.CH: 字符串src
  49. src.EN: String src
  50. */
  51. void strcat(char *dest, char *src);
  52. /*
  53. CH: 获取字符串s从第一个字符c开始的子串
  54. EN: Return the string's substring from character c
  55. s.CH: 字符串
  56. s.EN: String
  57. c.CH: 给定字符
  58. c.EN: Given char
  59. */
  60. char* index(char *s, int c);
  61. /*
  62. CH: 获取字符串s从最后一个字符c开始的子串
  63. EN: Return the string's substring from character c
  64. s.CH: 字符串
  65. s.EN: String
  66. c.CH: 给定字符
  67. c.EN: Given char
  68. */
  69. char* rindex(char *s, int c);
  70. /*
  71. CH: 获取字符串长度
  72. EN: Return the length of string
  73. arg1.CH: 字符串
  74. arg1.EN: String
  75. */
  76. int strlen(char *);
  77. /*
  78. CH: 将一段内存设置为val
  79. EN: Set the memory range to val
  80. arg1.CH: 内存
  81. arg1.EN: Memory
  82. val.CH: 写入的值
  83. val.EN: Write value
  84. count.CH: 写入的长度
  85. count.EN: The length of writing
  86. */
  87. void memset(void *, int val, int count);
  88. /*
  89. CH: 拷贝内存
  90. EN: Copy memory
  91. dst.CH: 目的地址
  92. dst.EN: Dest pointer
  93. src.CH: 源地址
  94. src.EN: Source pointer
  95. count.CH: 拷贝长度
  96. count.EN: The length to copy
  97. */
  98. void memcpy(void *dst, void *src, int count);
  99. /*
  100. CH: 计算两个字符串的标准差值,比较count个长度
  101. EN: Compare the given two [memory, memory+count)
  102. lhs.CH: 内存1
  103. lhs.EN: Memory 1
  104. rhs.CH: 内存2
  105. lhs.EN: Memory 2
  106. count.CH: 比较长度
  107. count.EN: Compare length
  108. */
  109. int memcmp(void *lhs, void *rhs, int count);
  110. /*
  111. CH: 在参数 str 所指向的字符串中搜索第一次出现字符 c(一个无符号字符)的位置
  112. EN: Searches the string pointed to by the argument str for the first occurrence of the character c (an unsigned character)
  113. c.CH: 给定字符
  114. c.EN: Given char
  115. */
  116. char* strchr(char *s, int c);
  117. /*
  118. CH: 检索字符串 s 开头连续有几个字符都不含字符串 charset 中的字符
  119. EN: Retrieve several consecutive characters at the beginning of the string s that do not contain the characters in the string charset
  120. s.CH: 字符串s
  121. s.EN: String s
  122. charset.CH: 字符集合串
  123. charset.EN: Char set string
  124. */
  125. size_t strcspn(char *s, char *charset);
  126. /*
  127. CH: 把 src 所指向的字符串追加到 dest 所指向的字符串的结尾,直到 n 字符长度为止
  128. EN: Appends the string pointed to by src to the end of the string pointed to by dest until n characters long
  129. dest.CH: 目的串
  130. dest.EN: Dest string
  131. src.CH: 字符串
  132. src.EN: String
  133. n.CH: 长度
  134. n.EN: Length
  135. */
  136. char* strncat(char *dest, char *src, size_t n);
  137. /*
  138. CH: 检索字符串 s 中第一个匹配字符串 charset 中字符的字符,不包含空结束字符
  139. EN: Retrieves the first character in the string s that matches the characters in the string charset, excluding the null terminator
  140. s.CH: 字符串
  141. s.EN: String
  142. charset.CH: 字符集合串
  143. charset.EN: Char set String
  144. */
  145. char* strpbrk(char *s, char *charset);
  146. /*
  147. CH: 在参数 s 所指向的字符串中搜索最后一次出现字符 __c(一个无符号字符)的位置
  148. EN: Searches the string pointed to by the argument s for the position of the last occurrence of the character __c (an unsigned character)
  149. s.CH: 字符串
  150. s.EN: String
  151. __c.CH: 一个无符号字符
  152. __c.EN: An unsigned character
  153. */
  154. char* strrchr(char *s, int __c);
  155. /*
  156. CH: 检索字符串 s 中第一个不在字符串 charset 中出现的字符下标
  157. EN: Retrieves the subscript of the first character in the string s that does not appear in the string charset
  158. s.CH: 字符串
  159. s.EN: String
  160. charset.CH: 字符集合串
  161. charset.EN: Char set String
  162. */
  163. size_t strspn(char *s, char *charset);
  164. /*
  165. CH: 在字符串 big 中查找第一次出现字符串 little 的位置,不包含终止符 '\0'
  166. EN: Find the first occurrence of the string little in the string big, excluding the terminator '\0'
  167. big.CH: 字符串big
  168. big.EN: String big
  169. little.CH: 字符串little
  170. little.EN: String little
  171. */
  172. char* strstr(char *big, char *little);
  173. /*
  174. CH: 分解字符串 str 为一组字符串,sep 为分隔符
  175. EN: Decompose the string str into a set of strings, sep is the delimiter
  176. str.CH: 字符串str
  177. str.EN: String str
  178. sep.CH: 分隔符
  179. sep.EN: Seperator
  180. */
  181. char* strtok(char *str, char *sep);
  182. /*
  183. CH: 根据程序当前的区域选项中的 LC_COLLATE 来转换字符串 src 的前 n 个字符,并把它们放置在字符串 dest 中
  184. EN: Convert the first n characters of the string src according to LC_COLLATE in the program's current locale options and place them in the string dest
  185. dest.CH: 目的串
  186. dest.EN: Dest string
  187. src.CH: 源字符串
  188. src.EN: Source string
  189. n.CH: 长度
  190. n.EN: length
  191. */
  192. size_t strxfrm(char *dest, char *src, size_t n);