随笔-90  评论-449  文章-0  trackbacks-0
输入:
  pattern : 含有通配符*与?的字符串
  string : 被匹配的字符串
输出:true与false代表匹配成功与失败

 1 func match :: (list char-> (list char-> bool
 2 def match pattern string =
 3   select pattern of
 4     case empty : 
 5       select string of
 6         case empty : true
 7         else : false
 8       end
 9     case list charp tailp : 
10       select string of
11         case empty : and (equ charp '*') (match tailp empty)
12         case list chars tails :
13           select charp of
14             case '?' : match tailp tails
15             case '*' : or (match tailp tails) (match pattern tails)
16             else : and (equ charp chars) (match tailp tails)
17           end
18       end
19   end
posted on 2008-10-02 01:41 陈梓瀚(vczh) 阅读(1102) 评论(0)  编辑 收藏 引用 所属分类: 脚本技术

标题  
姓名  
主页
验证码 *
内容(提交失败后,可以通过“恢复上次提交”恢复刚刚提交的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
[使用Ctrl+Enter键可以直接提交]
相关链接:
网站导航: