日期:2014-05-17 浏览次数:20875 次
string temp = "上海市徐汇区桂林路158号1202室"; string[] result = Regex.Split(temp,@"(?<=\d+)(?=\D)|(?<=\D+)(?=\d)"); /* * [0] "上海市徐汇区桂林路" string [1] "158" string [2] "号" string [3] "1202" string [4] "室" string */
------解决方案--------------------
别人给留言的转
1楼 simadi 2012-07-18 09:35发表 [回复] [引用] [举报] [删除]何必那么麻烦??
var a = "d899er670sdDSf0dfs900就好9dsf";
var b = Regex.Replace(a, @"[^\d]+", "");//去除非数字
//var b = Regex.Replace(a, @"[^a-zA-Z]+", "");//去除非字母
//var b = Regex.Replace(a, @"[^\u4e00-\u9fa5]+", "");//去除非汉字
MessageBox.Show(b);