当前位置:编程学习 > 网站相关 >>

使用 TypeProviders

使用 TypeProviders
 
#r @"D:\工具\TypeProviders\packages\FSharpx.TypeProviders.Regex.1.7.4\lib\40\FSharpx.TypeProviders.Regex.dll";;
 
type T = FSharpx.Regex< @"(?<AreaCode>^\d{3})-(?<PhoneNumber>\d{3}-\d{4}$)">
let reg = T()   www.zzzyk.com
let result = T.IsMatch("425- 123-2345")
let r1 = reg.Match("425-123-2345").AreaCode.Value 
let r2 = reg.Match("425-123-2345").PhoneNumber.Value
reg.Match("425-123-2345").Groups.Count
reg.Match("425-123-2345").Groups.[0].Value
reg.Match("425-123-2345").Groups.[1].Value
reg.Match("425-123-2345").Groups.[2].Value
reg.Match("425-123-2345").Groups.[4].Value
reg.GetGroupNumbers().Length
reg.GetGroupNames()
补充:综合编程 , 其他综合 ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,