获取字符串类型/**
*判断中英文
*/
publicfunctioncheckStr($str){
$output=‘‘;///\<[\s\S]*\>/i
$a=preg_match(‘/[‘.chr(0xa1).‘-‘.chr(0xff).‘]/i‘,$str);
$b=preg_match(‘/[0-9]/i‘,$str);
$c=preg_match(‘/[a-zA-Z]/i‘,$str);
if($a&&$b&&$c){
..
分类:
Web程序 时间:
2014-10-09 02:26:18
阅读次数:
314
1. preg_match()函数 preg_match()函数在字符串中搜索模式,如果存在则返回true,否则返回false $pattern='/php/'; $str='php100.com'; echo preg_match($pattern,$str); 输出结果:12. preg_g.....
分类:
Web程序 时间:
2014-10-08 14:36:45
阅读次数:
214
JavaScript RegExp对象的exec()方法用来匹配字符串,它的行为与match()有些不同。对于RegExpObject.exec(),w3school上面是这样介绍的:exec() 方法的功能非常强大,它是一个通用的方法,而且使用起来也比 test() 方法以及支持正则表达式的 St...
分类:
编程语言 时间:
2014-10-08 13:20:35
阅读次数:
230
字符串匹配算法有很多种,最为常用的有KMP算法、普通算法。
1、普通算法:此算法是效率最低的算法,时间复杂度为O(NM)。
程序如下:
bool str_match(const char * str1, const char * str2)//O(P*T)
{
assert(str1 != NULL && str2 != NULL);
int k = 0;
for (unsigned ...
分类:
其他好文 时间:
2014-10-07 17:56:23
阅读次数:
132
Problem Description
Unfortunately YY gets ill, but he does not want to go to hospital. His girlfriend LMY gives him N kinds of medicine, which may be helpful. It is not a good idea to take all of t...
分类:
其他好文 时间:
2014-10-07 13:51:33
阅读次数:
217
我在 VS 14 CTP 中新建了一个空的 app store 项目名叫 PlayWithXaml ,项目的 MainPage.xaml 文件改为了以下内容: I don't feel good 现在...
分类:
移动开发 时间:
2014-10-06 16:59:00
阅读次数:
283
一个int占多少个字节?这个问题我们往往得到的答案是4.可是int究竟占多少个字节,却跟你的机器环境有关.As you can see, the typical data type sizes match the ILP32LL model, which is what most compilers...
分类:
其他好文 时间:
2014-10-06 11:44:30
阅读次数:
211
在php升级到php5.3之后后,在使用的过程经常发现有的程序会出现Function eregi() is deprecated 的报错信息。是什么原因呢?这是因为php5.3中不再支持eregi()函数,而使用preg_match()函数替代。解决的方法是:将eregi()函数替换成preg_ma...
分类:
其他好文 时间:
2014-10-05 14:41:28
阅读次数:
206
在使用一个cell的时候发生的, func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell = tableV...
分类:
移动开发 时间:
2014-10-04 19:12:06
阅读次数:
223
$x("//a") //xpathvar a=/d+/gia.exec(document.body.innerText) //regular expressiondocument.body.innerText.match(a)
分类:
其他好文 时间:
2014-10-03 19:12:05
阅读次数:
158