Click here to Skip to main content
15,885,137 members
Articles / Web Development / ASP.NET

Pascal and Camel Case to Display Text Conversion

Rate me:
Please Sign up or sign in to vote.
4.86/5 (4 votes)
8 Jun 2011CPOL 15.8K   2  
Why not take care of the first character before the loop, instead of checking it every time (not that it makes a big difference on modern hardware)? This also moves the char declaration out of the loop.private string createDisplayText(string propertyName){ if...

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
8 Jun 2011Ben Kotvis 2 alternatives  
Pascal and Camel Case to display text conversion
Please Sign up or sign in to vote.
14 Jun 2011Steve Roberson
This version treats the input string as an indexed string. The code is a little shorter.private string createDisplayText(string propertyName){ if (String.IsNullOrEmpty(propertyName)) { return String.Empty; } StringBuilder builder = new StringBuilder(); ...

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions