Mega Code Archive

 
Categories / C# / Data Types
 

Converts a space delimited string into a single, compound pascal case string

//-------------------------------------------------------------------------------------------------------------------------------------------------------- // <copyright file="StringExtensions.cs"> //     Copyright Â© 2010 Oli Francis //     This source code is subject to the terms and conditions of the MIT license. A copy of the license can be found in the license.txt  //     file at the root of this distribution. By using this source code in any fashion, you are agreeing to be bound by the terms of the MIT License.  //     You must not remove this notice from the software. // </copyright> // <author>Oli</author> //------------------------------------------------------------------------------------------------------------------------------------------------------- namespace TeamBrain.Tests.Utilities {     using System;     using System.Linq;     /// <summary>     /// Extension methods on the string type     /// </summary>     public static class StringExtensions     {         /// <summary>         /// Converts a space delimited string into a single, compound pascal case string         /// </summary>         public static string ToPascalCase(this string text)         {             return String.Join(string.Empty, from s in text.Split(' ') select s[0].ToString().ToUpper() + s.Substring(1));         }     } }