Mega Code Archive

 
Categories / C# / Data Types
 

To String Camel Case

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; namespace NetworkAssetManager.WMI {     class WMIUtil     {         public static string ToStringCamelCase(object data)         {             string retString = string.Empty;              if ( data == null)             {                 return "";              }             else             {                 retString = data.ToString();                 retString.Trim();             }             string sTemp = Regex.Replace(retString, "([A-Z][a-z])", " $1", RegexOptions.Compiled).Trim();             return Regex.Replace(sTemp, "([A-Z][A-Z])", " $1", RegexOptions.Compiled).Trim();         }     } }