Split camelCase string in C#
Sep 10, 2009
Recently in our project there was a requirement were in the validation of the large number text boxes were required to be done.
We were following the camel casing as a naming convection for the text box. Mention below function was used to break the camel case and show the appropriate message to the user.
You require passing the camel case string to the function SplitCamelCase and it will return the necessary string.
Hope this helps.
Share
We were following the camel casing as a naming convection for the text box. Mention below function was used to break the camel case and show the appropriate message to the user.
You require passing the camel case string to the function SplitCamelCase and it will return the necessary string.
public string SplitCamelCase(string CamelCaseString)
{
return System.Text.RegularExpressions.Regex.Replace(CamelCaseString,
"([A-Z])",
" $1",
System.Text.RegularExpressions.RegexOptions.Compiled
).Trim();
}
Hope this helps.
Share
Labels:
C#