当前位置:网站首页>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;
}
边栏推荐
- Intelligent gateway helps improve industrial data acquisition and utilization
- On Multus CNI
- 基于线性函数近似的安全强化学习 Safe RL with Linear Function Approximation 翻译 1
- 入职中国平安三周年的一些总结
- Service developers publish services based on EDAs
- Latex error: missing delimiter (. Inserted) {\xi \left( {p,{p_q}} \right)} \right|}}
- Idea SSH channel configuration
- C language pointer interview question - the second bullet
- Doris / Clickhouse / Hudi, a phased summary in June
- Use C to extract all text in PDF files (support.Net core)
猜你喜欢
Realsense of d435i, d435, d415, t265_ Matching and installation of viewer environment
转载:等比数列的求和公式,及其推导过程
RHCE - day one
Architecture introduction
六月份阶段性大总结之Doris/Clickhouse/Hudi一网打尽
Static comprehensive experiment ---hcip1
Histogram equalization
VLAN part of switching technology
Application of safety monitoring in zhizhilu Denggan reservoir area
Rhcsa day 10 operation
随机推荐
Histogram equalization
OSPF comprehensive experiment
Container cloud notes
Lavel document reading notes -how to use @auth and @guest directives in lavel
Servlet基本原理与常见API方法的应用
Summary of reasons for web side automation test failure
Reprint: summation formula of proportional series and its derivation process
PHP代码审计3—系统重装漏洞
7-17 crawling worms (15 points)
Pcl:: fromrosmsg alarm failed to find match for field 'intensity'
Hands on deep learning (46) -- attention mechanism
【Day2】 convolutional-neural-networks
Hands on deep learning (III) -- Torch Operation (sorting out documents in detail)
Deep learning 500 questions
转载:等比数列的求和公式,及其推导过程
On Multus CNI
El Table Radio select and hide the select all box
【Day1】 deep-learning-basics
Network disk installation
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