为了账号安全,请及时绑定邮箱和手机立即绑定

与路径的排列组合?

与路径的排列组合?

C#
斯蒂芬大帝 2021-07-06 17:54:41
我有输入就像“dir1/dir2/Demo.txt”结合我想要的输出“dir1/dir2/Demo.txt”“dir1/dir2/DEMO.txt”"dir1/DIR2/Demo.txt"“dir1/DIR2/DEMO.txt”"DIR1/dir2/Demo.txt""DIR1/dir2/DEMO.txt"“DIR1/DIR2/Demo.txt”"DIR1/DIR2/DEMO.txt"据我所知,我编写的代码如下  var s = "dir1/dir2/Demo.txt";   List<string> listPermutations = new List<string>();   string[] array = s.Split('/');   int iterations = (1 << array.Length) -1;   for( int i = 0; i <= iterations; i++ )   {       for( int j = 0; j < array.Length; j++ )            array[j] = (i & (1<<j)) != 0                ? array[j].ToUpper()                : array[j];       listPermutations.Add(string.Join("/",array ));   }
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 151 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信