当前位置:网站首页>[C language] add separator to string
[C language] add separator to string
2022-06-25 07:11:00 【ChenXiaoMing start】
Action()
{
char str[]="12345";
char result_str[1024];
add_break(str,",",result_str);
lr_error_message("%s\n",result_str);
return 0;
}
void add_break(char * str,char * str_break,char result_str[1024]){
int i = 0;
int str_len=strlen(str);
memset(result_str,0,sizeof(result_str));
sprintf(result_str,"%c",str[0]);
for (i=1;i<str_len;i++) {
sprintf(result_str,"%s%s%c",result_str,str_break,str[i]);
}
}
边栏推荐
猜你喜欢

深入解析 Apache BookKeeper 系列:第三篇——读取原理

父爱的表达方式

Understand ZBrush carving software and game modeling analysis

CTFHub-Web-信息泄露-目錄遍曆

48 pictures | teach you the performance monitoring, pressure testing and tuning of microservices by hand

Derivation of COS (a-b) =cosa*cosb+sina*sinb

Ctfhub web information disclosure directory traversal

Atomic alpha development board -- SD card and EMMC burning tool

レレ / 蕾蕾

The process of making wooden barrels with 3DMAX software: a three-step process
随机推荐
Are you still doing the dishes yourself? Teach you how to make dishwasher controller with single chip microcomputer
Design of PWM breathing lamp based on FPGA
Analysis of China's food cold chain logistics, output of quick-frozen noodles and rice products and operation of major enterprises in 2021 [figure]
原子Alpha开发板--SD卡和emmc烧录工具
基于 KubeSphere 的分级管理实践
ES can finally find brother Wukong!
Query JSON data in MySQL table
Blue Bridge Cup SCM module code (external interrupt) (code + comment)
The process of making wooden barrels with 3DMAX software: a three-step process
Message queue table structure for storing message data
48 张图 | 手摸手教你微服务的性能监控、压测和调优
Who can teach me how to learn SCM, what to learn first and how to get started?
哇哦,好丰富呀。
Drawing shp files using OpenGL
StreamNative Platform 1.5 版本发布,集成 Istio、支持 OpenShift 部署
Following the last minor upgrade of nodemcu (esp8266)
PHP converts strings to hex and hex to string - PHP convert string to hex and hex to string
shell 上下两行合并成一行
In a single-page app, what is the right way to deal with wrong URLs (404 errors)?
Power representation in go language