当前位置:网站首页>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;
}
边栏推荐
- How can Huawei online match improve the success rate of player matching
- Summary of reasons for web side automation test failure
- SQL replying to comments
- 什么是 DevSecOps?2022 年的定义、流程、框架和最佳实践
- Exercise 7-4 find out the elements that are not common to two arrays (20 points)
- Safety reinforcement learning based on linear function approximation safe RL with linear function approximation translation 2
- Mmclassification annotation file generation
- Exercise 8-7 string sorting (20 points)
- 【FAQ】华为帐号服务报错 907135701的常见原因总结和解决方法
- Differences among opencv versions
猜你喜欢
Tables in the thesis of latex learning
RHCE day 3
If the uniapp is less than 1000, it will be displayed according to the original number. If the number exceeds 1000, it will be converted into 10w+ 1.3k+ display
【Day2】 convolutional-neural-networks
SQL replying to comments
C language pointer interview question - the second bullet
Reprint: summation formula of proportional series and its derivation process
Number of relationship models
Devop basic command
OSPF summary
随机推荐
The time difference between the past time and the present time of uniapp processing, such as just, a few minutes ago, a few hours ago, a few months ago
Golang type comparison
Dynamic memory management
Hands on deep learning (39) -- gating cycle unit Gru
El Table Radio select and hide the select all box
leetcode1229. Schedule the meeting
Deep learning 500 questions
Safety reinforcement learning based on linear function approximation safe RL with linear function approximation translation 2
Servlet基本原理与常见API方法的应用
Summary of reasons for web side automation test failure
Exercise 8-10 output student grades (20 points)
OSPF comprehensive experiment
Normal vector point cloud rotation
System. Currenttimemillis() and system Nanotime (), which is faster? Don't use it wrong!
C language pointer interview question - the second bullet
Four characteristics and isolation levels of database transactions
Exercise 9-3 plane vector addition (15 points)
Introduction to extensible system architecture
Basic principle of servlet and application of common API methods
有老师知道 继承RichSourceFunction自定义读mysql怎么做增量吗?