当前位置:网站首页>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;
}
边栏推荐
- Static comprehensive experiment ---hcip1
- Exercise 9-5 address book sorting (20 points)
- On Multus CNI
- Intelligent gateway helps improve industrial data acquisition and utilization
- Latex insert picture, insert formula
- Hands on deep learning (40) -- short and long term memory network (LSTM)
- 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
- Kotlin set operation summary
- DDL statement of MySQL Foundation
- Check 15 developer tools of Alibaba
猜你喜欢
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
Custom type: structure, enumeration, union
Idea SSH channel configuration
Today's sleep quality record 78 points
Summary of reasons for web side automation test failure
DML statement of MySQL Foundation
Hands on deep learning (44) -- seq2seq principle and Implementation
MongoDB数据日期显示相差8小时 原因和解决方案
Architecture introduction
BGP ---- border gateway routing protocol ----- basic experiment
随机推荐
Rhcsa day 9
RHCE day 3
Hands on deep learning (44) -- seq2seq principle and Implementation
Hands on deep learning (42) -- bi-directional recurrent neural network (BI RNN)
Rhcsa learning practice
Safety reinforcement learning based on linear function approximation safe RL with linear function approximation translation 2
Hlk-w801wifi connection
MySQL case
Application of safety monitoring in zhizhilu Denggan reservoir area
System.currentTimeMillis() 和 System.nanoTime() 哪个更快?别用错了!
AUTOSAR从入门到精通100讲(106)-域控制器中的SOA
Static comprehensive experiment ---hcip1
Advanced technology management - how to design and follow up the performance of students at different levels
Occasional pit compiled by idea
Ruby时间格式转换strftime毫秒匹配格式
Network disk installation
uniapp---初步使用websocket(长链接实现)
Today's sleep quality record 78 points
Kotlin: collection use
有老师知道 继承RichSourceFunction自定义读mysql怎么做增量吗?