提示コードですがD&Dで取得した文字列でクライントパスの文字列と一致する部分を別の文字列に変換する方法が知りたいです。
Replace ではうまく動作しませんでした。
C#
1 2 3 static void Main(string[] args) 4 { 5 6 //string str = args[0]; 7 string str = Console.ReadLine(); //ファイル名をD&D 8 str = DeleteDoubleQuote(str); //ダブルクォートを外す 9 10 List<string> filePath = GetDirectory(str); //ディレクトリを取得 11 List<string> destPath = new List<string>(); //保存先のパス 12 13 string cc = Directory.GetCurrentDirectory(); //クライアントのパス 14 Console.WriteLine("クライアントパス: " + cc); 15 16 string tt = filePath[0].Replace(cc,"aaaaaa"); 17 Console.WriteLine(tt); 18 19 20 foreach (string n in filePath) 21 { 22 //Console.WriteLine(n); 23 // Console.WriteLine(Path.GetDirectoryName(n)); 24 25 } 26 27 28 Console.ReadKey(); 29 30 }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2021/04/02 09:33
2021/04/02 09:42