日期:2014-05-17 浏览次数:20777 次
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string bedString1 = "大床(200cm*250cm) 双床(182cm*200cm)";
string result = Regex.Replace(bedString1, @"((\d+)cm\*(\d+)cm)", new MatchEvaluator(m => string.Format("({0}m*{1}m)", (double)((Convert.ToInt32(m.Groups[1].Value) + 5) / 10) / 10.0, (double)((Convert.ToInt32(m.Groups[2].Value) + 5) / 10) / 10.0)));
Console.WriteLine(result);
}
}
}