SQLite .net 正则 扩展 自定义函数

2009年5月14日星期四

SQLite .net 正则 扩展 自定义函数

 using System.Data.SQLite;


    [SQLiteFunction(Name = "RegExp", Arguments = 2, FuncType = FunctionType.Scalar)]  
    class RegExp : SQLiteFunctionEx
    {


      // 使用方法 : Select RegExp('[\d]','abcd1234')
        public override object Invoke(object[] args)
        {
            return System.Text.RegularExpressions.Regex.IsMatch(Convert.ToString(args[1]), Convert.ToString(args[0]));
        }
    } 



0 评论:

发表评论