当前位置:网站首页>C语言 | 获取字符串里逗号间隔的内容
C语言 | 获取字符串里逗号间隔的内容
2022-07-31 05:11:00 【Benni-King】
#include <stdio.h>
int main()
{
int i=0;
char** paraList = calloc(30, sizeof(char));
char str[] = "abc , I am good , you good too";
char delims[] = ",";
char *result = NULL;
result = strtok(str, delims);
while (result != NULL) {
printf("result is \"%s\"\t", result);
while (*result == ' '|| *result == '\t') result++;
printf("result is \"%s\"\n", result);
paraList[i] = result;
i++;
result = strtok(NULL, delims);
}
}
边栏推荐
猜你喜欢
随机推荐
在kali上搭建vulhub漏洞靶场
[Elastic-Job] Overview of Distributed Scheduling Tasks
wpf ScrowViewer水平滚动
【Elastic-Job】分布式调度任务概览篇
Redis管道技术/分区
1D, 2D, 3D convolution operations in pytorch
最新MySql安装教学,非常详细
leetcode-每日一题1252. 奇数值单元格的数目(模拟优化)
Oracle数据库中的“limit”查询
10 【组件编码流程 组件自定义事件 全局事件总线】
uni-app进阶之生命周期【day8】
Error: Cannot find module 'D:\Application\nodejs\node_modules\npm\bin\npm-cli.js'
DeFi 项目中的治理Token
wpf wrapPanel居中并从左到右排列
【ubuntu20.04安装MySQL以及MySQL-workbench可视化工具】
"limit" query in Oracle database
PAT_乙级_真题练习_1007_素数对猜想
梳理一下自己常用的快捷键
利用phpstudy搭建DVWA
leetcode-每日一题558. 四叉树交集(分治递归)