日期:2014-05-17 浏览次数:20758 次
public static void ShowResult()
{
string str = "X,P
------解决方案--------------------
黑色,红色
------解决方案--------------------
T,C";
string[] temp1 = str.Split('
------解决方案--------------------
');
List<string> list = new List<string>();
foreach (string s in temp1)
{
if (list.Count == 0)
list.AddRange(s.Split(','));
else
list = JoinPart(list, s.Split(','));
}
foreach (string s in list)
Console.WriteLine(s);
}
public static List<string> JoinPart(List<string> part1, string[] part2)
{
List<string> result = new List<string>();
foreach (string str1 in part1)
{
foreach (string str2 in part2)
{
result.Add(str1 + " " + str2);
}
}
return result;
}