当前位置:网站首页>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;
}
边栏推荐
- Architecture introduction
- libmysqlclient. so. 20: cannot open shared object file: No such file or directory
- Machine learning -- neural network (IV): BP neural network
- Introduction to extensible system architecture
- RHCE day 3
- Talk about scalability
- Devop basic command
- Mmclassification annotation file generation
- C language pointer interview question - the second bullet
- Exercise 9-1 time conversion (15 points)
猜你喜欢

MPLS: multi protocol label switching

Safety reinforcement learning based on linear function approximation safe RL with linear function approximation translation 2

5g/4g wireless networking scheme for brand chain stores

Introduction to extensible system architecture

VLAN part of switching technology

Safety reinforcement learning based on linear function approximation safe RL with linear function approximation translation 1
![[200 opencv routines] 218 Multi line italic text watermark](/img/3e/537476405f02f0ebd6496067e81af1.png)
[200 opencv routines] 218 Multi line italic text watermark

MongoDB数据日期显示相差8小时 原因和解决方案

【OpenCV 例程200篇】218. 多行倾斜文字水印

Normal vector point cloud rotation
随机推荐
Es advanced series - 1 JVM memory allocation
Check 15 developer tools of Alibaba
Rhcsa12
MongoDB数据日期显示相差8小时 原因和解决方案
Ruby time format conversion strftime MS matching format
Exercise 9-4 finding books (20 points)
PHP code audit 3 - system reload vulnerability
Safety reinforcement learning based on linear function approximation safe RL with linear function approximation translation 2
Use C to extract all text in PDF files (support.Net core)
Golang type comparison
Dos:disk operating system, including core startup program and command program
Leetcode48. Rotate image
【Day2】 convolutional-neural-networks
OSPF comprehensive experiment
Dynamic address book
Golang defer
leetcode1229. Schedule the meeting
2. Data type
Realsense d435 d435i d415 depth camera obtains RGB map, left and right infrared camera map, depth map and IMU data under ROS
DDL statement of MySQL Foundation