strstr(string,string) = strchr(,) //从前面第一次出现某个字符串的地方截取到最后strrchr(string,string) //从某个字符串从最后出现的位置截取到结尾strpos(string,string[,int]) //某个字符串第一次出现的位置strrpo...
分类:
Web程序 时间:
2014-08-18 09:11:43
阅读次数:
230
反正总是有人要赢,那为什么不能是我呢~[问题描述]Implement strStr().Returns a pointer to the first occurrence of needle in haystack, ornullif needle is not part of haystack.[...
分类:
其他好文 时间:
2014-08-15 14:14:58
阅读次数:
197
库函数的运用。。。。
#include
#include
#include
int a[100000],b[100000];
void change(char *a)
{
int i,len;
len=strlen(a);
if (strstr(a,"."))
for(i=len-1;a[i]=='0';i--)
{
a[i]='\0...
分类:
其他好文 时间:
2014-08-14 20:51:19
阅读次数:
176
KMP的应用。直接使用s1产生next 数组,然后在s2中搜索s1,那么记录最后一个搜索到的数值,就是s1的前缀在s2中的最长后缀了。
本题应该不能直接调用strstr了吧。
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
...
分类:
其他好文 时间:
2014-08-12 19:09:14
阅读次数:
192
这道题第一眼看见题目所给的时间就有一种预感,仅仅是600ms,运行的算法复杂度稍微高一点就会超时。那么我首先是犯傻想偷偷懒,直接是调用一个系统库函数strstr(),希望它能够完成自己的题目,但是显然是超时的。百度了一下它的实现方法是直接采用没有优化的算法,复杂度是最高的。但是由于自己压根就不会写字...
分类:
其他好文 时间:
2014-08-09 18:15:38
阅读次数:
291
题目:Implement strStr().Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack.题解:其实我觉得这题。。为啥不给个更明确....
分类:
编程语言 时间:
2014-08-07 12:43:19
阅读次数:
227
文件名类型有:http://localhost/code/loginfile/index.ini.php?username=aaaE:\xampp\php/login.phplogin.phpfunctionfile_extension($url)
{
//第一步:判断是否有问号"?"
$file="";//存储整个文件名称
if(strstr($url,"?")){
list($file)=explode("?",$url);
}
else
..
分类:
其他好文 时间:
2014-08-03 23:32:06
阅读次数:
316
本题可以使用暴力法直接求解,思路也挺简单的,不过实现起来也挺麻烦的。
本题最暴力直接使用strstr过。 这里使用hash表的方法过,这种方法好像有个学名的,主要思路就是把一个需要查找的字符串赋予一个数值,那么就可以把一串字符串的比较转换为一个值的比较了,那么就可以加速字符串的查找了。
#include
#include
#include
const long long MOD = (...
分类:
其他好文 时间:
2014-08-03 15:23:05
阅读次数:
326
KMP算法:/** KMP算法中获取模式中每位的next值。next[i]=j表示pattern[0..i]中最长前后缀后面的那个元素的位置为j在进行匹配的过程中,匹配失败则取得上一个 next 函数的值*/void get_next(char *pattern, int *next){int le...
分类:
其他好文 时间:
2014-07-31 13:03:16
阅读次数:
167
1、strlen()获得一个字符串的长度。
2、strstr()获取一个字符串的子串,也可以用来判断一个字符串是否存在于另一个子字符串中。这个函数不区分大小写。
3、strpos()找到一个子字符串的位置。
4、substr()提取一个字符串的一部分。区分大小写。
substr($test,3);//指向位置3以后的全部子字符串
substr($test,3,2)...
分类:
Web程序 时间:
2014-07-29 13:17:16
阅读次数:
280