I prefer to use Humanizer for this. Humanizer is a portable class library that meets all your .NET needs for managing and displaying strings, enumerations, dates, times, time intervals, numbers and quantities.
Short answer
"AwaitingFeedback".Humanize() => Awaiting feedback
Long and descriptive answer
Humanizer can do a lot more work, other examples:
"PascalCaseInputStringIsTurnedIntoSentence".Humanize() => "Pascal case input string is turned into sentence" "Underscored_input_string_is_turned_into_sentence".Humanize() => "Underscored input string is turned into sentence" "Can_return_title_Case".Humanize(LetterCasing.Title) => "Can Return Title Case" "CanReturnLowerCase".Humanize(LetterCasing.LowerCase) => "can return lower case"
Full code:
using Humanizer; using static System.Console; namespace HumanizerConsoleApp { class Program { static void Main(string[] args) { WriteLine("AwaitingFeedback".Humanize()); WriteLine("PascalCaseInputStringIsTurnedIntoSentence".Humanize()); WriteLine("Underscored_input_string_is_turned_into_sentence".Humanize()); WriteLine("Can_return_title_Case".Humanize(LetterCasing.Title)); WriteLine("CanReturnLowerCase".Humanize(LetterCasing.LowerCase)); } } }
Exit
Waiting for feedback
Pascal register input string turns into a sentence
An underlined input string turns into a sentence.
can return lower case
If you prefer to write your own C # code, you can achieve this by writing some of the C # code, as others have already answered.
Banketeshvar Narayan May 28 '16 at 16:14 2016-05-28 16:14
source share