Linux 内核可用的字符串瓜分函数 strsep (String Split Function strsep in Linux Kernel)

Linux 内核可用的字符串瓜分函数 strsep (String Split Function strsep in Linux Kernel)

Linux 内核可用的字符串分割函数 strsep (String Split Function strsep in Linux Kernel)

C 语言字符串分割可使用 strsep,是 strtok 函数的替代,而且可用于内核,推荐。

?

[cpp]?view plaincopy

  1. char?*strsep(char?**stringp,?const?char?*delim);??

?

函数接受的第一个参数是 in-out prarameter,在函数执行后会被更改,总指向当前要被分割的字符串;第二个参数顾名思义,是分割符。函数返回分割后的第一个字符串。函数执行的过程,是在 *stringp 中查找分割符,并将其替换为“”,返回分割出的第一个字符串指针(NULL 表示到达字符串尾),并更新 *stringp 指向下一个字符串。示例代码如下:

[cpp]?view plaincopy

    <li style="padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-color: initial; border-left-width: 3px; border-left-color: #6ce26c;

Linux 内核可用的字符串瓜分函数 strsep (String Split Function strsep in Linux Kernel)

相关文章:

你感兴趣的文章:

标签云: