Convert string to sentence case

image_pdfimage_print
   
 

///
/// ArmyBodger 3
/// (c)2010 richyp
///
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ArmyBodger.Core.Utilities {
    /// <summary>
    /// Some static helper methods
    /// </summary>
    public class Helpers {
        /// <summary>
        /// Convert the string e.g. fooBar to sentance case: FooBar
        /// </summary>
        /// <param name="source">The string to convert</param>
        /// <returns>The converted string</returns>
        public static string ConvertToSentenceCase(string source) {
            return source.Substring(0, 1).ToUpper() + source.Substring(1);
        }
    }
}

   
     


This entry was posted in Data Types. Bookmark the permalink.