- #include <stdio.h>
- #include <string.h>
-
- int main()
- {
- char str[] = " I # # love you ## more than ### you can imagine!#";
- char delims[] = "#";
-
- char *result = strtok(str, delims); // 连续多个分隔符算一个
- while(result != NULL)
- {
- printf( "%s\n", result);
- result = strtok(NULL, delims);
- }
-
- return 0;
- }
结果为:
I
love you
more than
you can imagine!

![[手游] 三网H5小游戏【少年仙路】WIN系服务端+Linux手工服务端+详细搭建教程](https://cdn.jxasp.com:9143/image/20260615/136BC33AA47EB0D84E878835A8B38FDB.png)

















