码迷,mamicode.com
首页 > 其他好文 > 详细

正则替换实现字符串链接每4位用“-”连接成新的字符串

时间:2016-12-31 22:48:25      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:replace   first   log   res   exp   express   http   ace   ext   

using System.Text.RegularExpressions;
//比如:74B87337454200D4D33F80C4663DC5E5运用它后就变成:74B8-7337-4542-00D4-D33F-80C4-663D-C5E5
string upstr = Regex.Replace(str, @"(\w{4}(?=[^$]))", "$1-");

 原文出处:http://www.cnblogs.com/firstcsharp/p/5430778.html

正则替换实现字符串链接每4位用“-”连接成新的字符串

标签:replace   first   log   res   exp   express   http   ace   ext   

原文地址:http://www.cnblogs.com/shy1766IT/p/6240270.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!