Veloe 1 year ago
parent
commit
878e26c8b6
1 changed files with 4 additions and 4 deletions
  1. 4 4
      StringReplacer/Program.cs

+ 4 - 4
StringReplacer/Program.cs

@@ -101,9 +101,9 @@ public static class Program
                 do
                 {
                     Console.Write("Path:");
-                    path = Console.ReadLine() ?? string.Empty;
+                    path = Console.ReadLine().Trim() ?? string.Empty;
                 }
-                while (!string.IsNullOrEmpty(path) && Directory.Exists(path));
+                while (!string.IsNullOrEmpty(path) && !Directory.Exists(path));
                 _logger.Information($"Path: {path}");
             }
 
@@ -112,7 +112,7 @@ public static class Program
                 do
                 {
                     Console.Write("Find:");
-                    word_Find = Console.ReadLine() ?? string.Empty;
+                    word_Find = Console.ReadLine().Trim() ?? string.Empty;
                 }
                 while (!string.IsNullOrEmpty(word_Find));
                 _logger.Information($"Find: {word_Find}");
@@ -123,7 +123,7 @@ public static class Program
                 do
                 {
                     Console.Write("Replace:");
-                    word_Replace = Console.ReadLine() ?? string.Empty;
+                    word_Replace = Console.ReadLine().Trim() ?? string.Empty;
                 }
                 while (string.IsNullOrEmpty(word_Replace));
                 _logger.Information($"Replace to: {word_Replace}");