Permalink
Browse files

closes GH-43

  • Loading branch information...
1 parent a28d2c4 commit 7bc93f941882e62a4fee12223b307f0d356ff14e @jeremydmiller jeremydmiller committed Jun 24, 2012
Showing with 16 additions and 0 deletions.
  1. +6 −0 src/FubuCore.Testing/StringExtensionsTester.cs
  2. +10 −0 src/FubuCore/StringExtensions.cs
@@ -246,5 +246,11 @@ public void should_split_on_pascal_case()
{
"PascalCaseString".SplitPascalCase().ShouldEqual("Pascal Case String");
}
+
+ [Test]
+ public void file_escape()
+ {
+ "my file".FileEscape().ShouldEqual("\"my file\"");
+ }
}
}
@@ -270,5 +270,15 @@ public static string SplitPascalCase(this string str)
if(!enumType.IsEnum) throw new ArgumentException("{0} is not an Enum".ToFormat(enumType.Name));
return (TEnum) Enum.Parse(enumType, text, true);
}
+
+ /// <summary>
+ /// Wraps a string with parantheses. Originally used to file escape file names when making command line calls
+ /// </summary>
+ /// <param name="file"></param>
+ /// <returns></returns>
+ public static string FileEscape(this string file)
+ {
+ return "\"{0}\"".ToFormat(file);
+ }
}
}

0 comments on commit 7bc93f9

Please sign in to comment.