当前位置:网站首页>Pointer -- eliminate all numbers in the string
Pointer -- eliminate all numbers in the string
2022-07-06 14:36:00 【|Light|】
requirement
Make up a function , Eliminate all numbers in the string .( Use a pointer to achieve )
Code
#include<stdio.h>
/* * This function is used to delete all numbers in the string *a Is a pointer to a string array */
char *delete_digit(char *a)
{
int l = strlen(a);
char b[l];
int i,j=0,k;
for(i=0;i<l;i++)
{
if(a[i]>='0'&&a[i]<='9')
continue;
else
{
b[j] = a[i];
j++;
}
}
for(i=0;i<l;i++)
{
a[i] = '\0';
}
for(i=0;i<l-2;i++)
{
if(b[i]=='.')
{
if(b[i+2]>='a'&&b[i+2]<='z')
continue;
else if(b[i+2]>='A'&&b[i+2]<='Z')
continue;
else
b[i+1]='\0';
}
}
strcpy(a,b);
return a;
}
main function
int main()
{
char a[200];
gets(a);
delete_digit(a);
puts(a);
return 0;
}
test
Test input
123Try234 you53r b5234est wh2435en y25ou2 are 5234young. 45324Never524 regret523.
Output
Try your best when you are young. Never regret.
边栏推荐
- 指针--剔除字符串中的所有数字
- Based on authorized access, cross host, and permission allocation under sqlserver
- Mathematical modeling idea of 2022 central China Cup
- Hackmyvm target series (2) -warrior
- 《统计学》第八版贾俊平第十一章一元线性回归知识点总结及课后习题答案
- ES全文索引
- Ucos-iii learning records (11) - task management
- 内网渗透之内网信息收集(二)
- Record an edu, SQL injection practice
- Intranet information collection of Intranet penetration (2)
猜你喜欢

Windows platform mongodb database installation

1.支付系统

《统计学》第八版贾俊平第十章方差分析知识点总结及课后习题答案

sqqyw(淡然点图标系统)漏洞复现和74cms漏洞复现

Sqqyw (indifferent dot icon system) vulnerability recurrence and 74cms vulnerability recurrence

Realize applet payment function with applet cloud development (including source code)

JVM memory model concept

攻防世界MISC练习区(SimpleRAR、base64stego、功夫再高也怕菜刀)

《统计学》第八版贾俊平第七章知识点总结及课后习题答案

Solutions to common problems in database development such as MySQL
随机推荐
DVWA (5th week)
指針:最大值、最小值和平均值
Mathematical modeling idea of 2022 central China Cup
flask实现强制登陆
《统计学》第八版贾俊平第十一章一元线性回归知识点总结及课后习题答案
数字电路基础(四) 数据分配器、数据选择器和数值比较器
关于超星脚本出现乱码问题
Build domain environment (win)
《统计学》第八版贾俊平第十二章多元线性回归知识点总结及课后习题答案
循环队列(C语言)
《统计学》第八版贾俊平第三章课后习题及答案总结
JVM memory model concept
Windows platform mongodb database installation
《统计学》第八版贾俊平第七章知识点总结及课后习题答案
数字电路基础(三)编码器和译码器
【指针】删除字符串s中的所有空格
The most popular colloquial system explains the base of numbers
JDBC read this article is enough
Intranet information collection of Intranet penetration (4)
Attack and defense world misc practice area (simplerar, base64stego, no matter how high your Kung Fu is, you are afraid of kitchen knives)