字符串匹配
精确:
indexOf(String str); -- strstr(), O(mn)。
lastIndexOf(String str); -- continue 的别样用法。
matches(String regex); -- Regex.compile()/match()。
模糊:
java package?
Spell Checker -- 两个字符串的相似程度...
分类:
编程语言 时间:
2014-06-20 11:00:18
阅读次数:
287
一、 验证 /** * 判断用户名是否规范 */ function
is_username($username) { if
(preg_match("/^[a-zA-Z]{1}([0-9a-zA-Z]|[._]){3,19}$/",$username)...
分类:
Web程序 时间:
2014-06-12 22:53:22
阅读次数:
221
拼音输入法输出的候选分成两个部分,系统词以及短句(智能组词),智能组词是通过model以及解码弄出来的,后续再说。
系统词就是那些常用的词(词组)收录到词典中,用户的输入和词典中的词match时,直接吐出来,而不需要解码获得。
系统词以及对应的rank(score)对输入法的体验很大,毕竟大多数用户还是继续短词输入。
系统词包含几个部分:
1.基础词
2.高频短串
3....
分类:
其他好文 时间:
2014-06-10 19:17:09
阅读次数:
231
ListView 的高度 必须要设置成一个明确的值 或者match_parent
不然就会调用多次getView方法
分类:
移动开发 时间:
2014-06-09 18:51:50
阅读次数:
253
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal" >
android:layout_width="wrap...
分类:
其他好文 时间:
2014-06-08 17:58:54
阅读次数:
633
代码清单:
<?php
/**
* 判断字符串是否为utf8编码,英文和半角字符返回ture
* @author ruxing.li
* @param $string
* @return bool
*/
function is_utf8($string) {
return preg_match('%^(?:
[\x09\x0A\x0D\x...
分类:
其他好文 时间:
2014-06-08 10:47:58
阅读次数:
267
首先从简单的搜索开始——empty
search,这个搜索返回所有的index中所有的document。GET
/_search{}标记1表示的是请求体就像query-string搜索一样,你能对若干index进行搜索,同时能指定若干若干类型:GET
/index_2014*/type1,type2...
分类:
其他好文 时间:
2014-06-06 08:43:17
阅读次数:
228
轻量级的搜索——?query string
search?——对命令行的即席查询来说是十分有用的。然而为了驾驭搜索的强大功能,你应该使用带请求体的search
API,之所以这样,是因为很多的参数是在JSON的请求体中的而不是查询字符串。请求体查询——从现在开始就是”search“——不仅仅自身处理...
分类:
其他好文 时间:
2014-06-06 08:21:47
阅读次数:
239
JS方法: $(function(){ is_weixn(); }) function
is_weixn(){ var ua = navigator.userAgent.toLowerCase();
if(ua.match(/MicroMesse...
分类:
微信 时间:
2014-06-04 18:04:49
阅读次数:
413
布局文件:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="...
分类:
移动开发 时间:
2014-06-01 04:04:04
阅读次数:
490