日期:2014-05-17 浏览次数:20933 次
string oldStr = "{1:\"a\"},{2:\"a\"},{3:\"a\"},{4:\"b\"},{5:\"b\"},{6:\"b\"},{7:\"c\"},{8:\"c\"},{9:\"c\"}"; string newStr = "{1:\"a\"},{5:\"a\"},{9:\"a\"},{2:\"b\"},{7:\"b\"},{6:\"b\"},{4:\"c\"},{3:\"c\"},{8:\"c\"}";
public static void iMove(string oldStr,string newStr) { ..... }
//输出 //2 移动到了 b 第一个 //3 移动到了 c 第二个 //4 移动到了 c 第一个 //5 移动到了 a 第二个 //7 移动到了 b第二个 //8 移动到了 c 第三个 //9 移动到了 a 第三个
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string oldStr = "{root:[{DivId:\"div1\",DivWidth:200,DivHeight:167,leftPosition:50,topPosition:34,DivParentId:\"lefts\"},{DivId:\"div10\",DivWidth:200,DivHeight:135,leftPosition:50,topPosition:208,DivParentId:\"lefts\"},{DivId:\"div9\",DivWidth:200,DivHeight:245,leftPosition:50,topPosition:350,DivParentId:\"lefts\"},{DivId:\"div8\",DivWidth:600,DivHeight:711,leftPosition:260,topPosition:34,DivParentId:\"centers\"},{DivId:\"div6\",DivWidth:600,DivHeight:551,leftPosition:260,topPosition:752,DivParentId:\"centers\"},{DivId:\"div3\",DivWidth:600,DivHeight:135,leftPosition:260,topPosition:1310,DivParentId:\"centers\"},{DivId:\"div5\",DivWidth:600,DivHeight:197,leftPosition:260,topPosition:1452,DivParentId:\"centers\"},{DivId:\"div4\",DivWidth:200,DivHeight:143,leftPosition:870,topPosition:34,DivParentId:\"rights\"},{DivId:\"div2\",DivWidth:200,DivHeight:135,leftPosition:870,topPosition:184,DivParentId:\"rights\"},{DivId:\"div7\",DivWidth:200,DivHeight:593,leftPosition:870,topPosition:326,DivParentId:\"rights\"}]}"; string newStr = "{root:[{DivId:\"div6\",DivWidth:200,DivHeight:167,leftPosition:50,topPosition:34,DivParentId:\"lefts\"},{DivId:\"div9\",DivWidth:200,DivHeight:135,leftPosition:50,topPosition:208,DivParentId:\"lefts\"},{DivId:\"div10\",DivWidth:200,DivHeight:245,leftPosition:50,topPosition:350,DivParentId:\"lefts\"},{DivId:\"div8\",DivWidth:600,DivHeight:711,leftPosition:260,topPosition:34,DivParentId:\"centers\"},{DivId:\"div1\",DivWidth:600,DivHeight:551,leftPosition:260,topPosition:752,DivParentId:\"centers\"},{DivId:\"div3\",DivWidth:600,DivHeight:135,leftPosition:260,topPosition:1310,DivParentId:\"centers\"},{DivId:\"div5\",DivWidth:600,DivHeight:197,leftPosition:260,topPosition:1452,DivParentId:\"centers\"},{DivId:\"div4\",DivWidth:200,DivHeight:143,leftPosition:870,topPosition:34,DivParentId:\"rights\"},{DivId:\"div2\",DivWidth:200,DivHeight:135,leftPosition:870,topPosition:184,DivParentId:\"rights\"},{DivId:\"div7\",DivWidth:200,DivHeight:593,leftPosition:870,topPosition:326,DivParentId:\&q