当前位置:网站首页>Sword finger offer 05 (implemented in C language)
Sword finger offer 05 (implemented in C language)
2022-07-04 10:24:00 【sqjddb】
describe
Please implement a function , Replace each space in a string with “%20”. for example , When the string is We Are Happy. The replaced string is We%20Are%20Happy.
char* replaceSpace(char* s ) {
char a[30] = {
0 };
int i = 0;
int length = strlen(s);
while (length--)
{
if (*s != ' ')
{
a[i] = *s;
++i;
s++;
}
else
{
a[i] = '%';
a[i + 1] = '2';
a[i + 2] = '0';
i += 3;
s++;
}
}
return a;
}
边栏推荐
- Latex learning insertion number - list of filled dots, bars, numbers
- Advanced technology management - how to design and follow up the performance of students at different levels
- Leetcode48. Rotate image
- 【Day2】 convolutional-neural-networks
- MySQL case
- 按键精灵跑商学习-商品数量、价格提醒、判断背包
- 使用 C# 提取 PDF 文件中的所有文字(支持 .NET Core)
- Service developers publish services based on EDAs
- Es advanced series - 1 JVM memory allocation
- DCL statement of MySQL Foundation
猜你喜欢
What are the advantages of automation?
El Table Radio select and hide the select all box
Latex error: missing delimiter (. Inserted) {\xi \left( {p,{p_q}} \right)} \right|}}
uniapp 处理过去时间对比现在时间的时间差 如刚刚、几分钟前,几小时前,几个月前
Work order management system OTRs
MySQL develops small mall management system
Tables in the thesis of latex learning
Debug:==42==ERROR: AddressSanitizer: heap-buffer-overflow on address
Normal vector point cloud rotation
From programmers to large-scale distributed architects, where are you (I)
随机推荐
Golang type comparison
Debug:==42==ERROR: AddressSanitizer: heap-buffer-overflow on address
Reprint: summation formula of proportional series and its derivation process
Rhcsa operation
Evolution from monomer architecture to microservice architecture
View CSDN personal resource download details
SQL replying to comments
DDL statement of MySQL Foundation
【Day2】 convolutional-neural-networks
Hands on deep learning (43) -- machine translation and its data construction
BGP advanced experiment
Qtreeview+ custom model implementation example
Development guidance document of CMDB
uniapp 处理过去时间对比现在时间的时间差 如刚刚、几分钟前,几小时前,几个月前
Vs201 solution to failure to open source file HPP (or link library file)
Hlk-w801wifi connection
Lavel document reading notes -how to use @auth and @guest directives in lavel
Machine learning -- neural network (IV): BP neural network
From programmers to large-scale distributed architects, where are you (2)
Fabric of kubernetes CNI plug-in