字串定位
来源:互联网 发布:ftp yum 源安装 编辑:程序博客网 时间:2024/06/04 18:09
#include<stdio.h>#include<string.h>#define MAXN 100+10char* substr(char sub[], char s[], int pos, int len){//取字串,从主串s的第pos个位置开始,取连续len个字符复制到sub int i; for(i=0; i<len; i++) sub[i]=s[pos+i]; sub[i]='\0'; return sub;}int main(){ char a[MAXN],b[MAXN],sub[MAXN]; int n,m, up, i; gets(a); gets(b); n=strlen(a); m=strlen(b); up=n-m+1; for(i=0; i<=up; i++) { substr(sub,a,i,m); if(strcmp(sub, b)==0) break; } if(i>up) printf("0"); else printf("%d",i); return 0;}
0 0
- 字串定位
- 字串
- 字串
- javascript常用代码(去字串两端空格、文本域光标定位到最后)
- 说说编译链接系统中的符号(symbol)、重定位(relocation)、字串表(string-table)和节(section)
- 说说编译链接系统中的符号(symbol)、重定位(relocation)、字串表(string-table)和节(section)
- 说说编译链接系统中的符号(symbol)、重定位(relocation)、字串表(string-table)和节(sec
- 字串处理
- 数据库连接字串
- 字串截取
- 字串copy
- 删除字串
- 字串距离
- 连接字串
- 字串数
- 提取字串
- 01字串
- 01字串
- CXF:将spring bean 注入到 jaxws:endpoin中去
- 软件测试的原则
- js event keyCode 用法
- 第一个只出现一次的字符
- UIPageViewController-解析
- 字串定位
- Leetcode: Convert Sorted Array to Binary Search Tree
- 学习nodejs笔记二
- PHP文件下载函数
- python函数参数详解
- 逆向-360逆向writeup
- ios多图片上传
- URL编码与反编码
- 对CTO的理解