代码:
1 public static string Trans_version(string simver) 2 { 3 var sarry = simver.Split(' '); 4 string TransVersion = ""; 5 if (sarry.Length == 2) 6 { 7 switch (sarry[0]) 8 { 9 case ">=": TransVersion = "[" + sarry[1] + ",)"; break; 10 case ">": TransVersion = "(" + sarry[1] + ",)"; break; 11 case "==": TransVersion = "[" + sarry[1] + "]"; break; 12 case "<=": TransVersion = "(," + sarry[1] + "]"; break; 13 case "<": TransVersion = "(," + sarry[1] + ")"; break; 14 } 15 } 16 else 17 { 18 switch (sarry[0]) 19 { 20 case ">=": TransVersion = "["+sarry[1]+"," ; break; 21 case ">": TransVersion = "("+sarry[1] + ","; break; 22 } 23 switch (sarry[2]) 24 { 25 case "<=": TransVersion += sarry[3] + "]"; break; 26 case "<": TransVersion +=sarry[3] + ")"; break; 27 } 28 29 } 30 return TransVersion; 31 }