Foxtable(狐表)用户栏目专家坐堂 → [求助]如何分离地理位置


  共有2518人关注过本帖树形打印复制链接

主题:[求助]如何分离地理位置

帅哥哟,离线,有人找我吗?
逛逛
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:1693 积分:12135 威望:0 精华:7 注册:2013/7/11 10:52:00
  发帖心情 Post By:2016/5/21 10:05:00 [显示全部帖子]

Dim s As String="甘肃省兰州市安宁区马家镇银滩路街道"
Dim l() As String = {"省","市","区","县","乡","镇","村","街道"}
Dim li As new List(of String)
For i As Integer = 0 To l.Length - 1
    If s.contains(l(i)) Then li.Add(l(i))
Next
If li.Count = 0 Then Return Nothing
Dim strRegex As String = "^"
For Each ss As String In li
    strRegex += "(?<" & ss & ">\w+)" & ss & "+"
Next
Dim r As New System.Text.RegularExpressions.Regex(strRegex.TrimEnd("+"))
For Each ss As String In li
    Output.show(r.Match(s).Result("${" & ss & "}") & ss)
Next

 回到顶部