Skip to content

Instantly share code, notes, and snippets.

@kimsama
Last active December 15, 2015 20:19
Show Gist options
  • Save kimsama/5317752 to your computer and use it in GitHub Desktop.
Save kimsama/5317752 to your computer and use it in GitHub Desktop.
A simple camel case string maker by using regexp. It may useful for making Unity3D's custom inspector gui with properties for ui constrol's name. (copied from http://www.example8.com/node/view/id/34476)
using System.Text;
using System.Text.RegularExpressions;
public static string SplitCamelCase(string inputCamelCaseString)
{
string sTemp = Regex.Replace(inputCamelCaseString, "([A-Z][a-z])", " $1", RegexOptions.Compiled).Trim();
return Regex.Replace(sTemp, "([A-Z][A-Z])", " $1", RegexOptions.Compiled).Trim();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment