输出一个字符串的所有排列组合,有重复字符
static void Main(string[] args)
{
string str2 = "";
Method("1234", str2);
Console.WriteLine(counter);
Console.ReadKey();
}
static void Method(string str,string str2)
{
if (str == null)
return;
if (str == string.Empty)
{
Console.WriteLine(str2);
counter++;
}
for (int i = 0; i < str.Length; i++)
{
Method(str.Remove(i, 1), str2+str[i].ToString());
}
}