How to capitalize the first letter of each word in a string

By Alan S. at July 23, 2010 12:43
Filed Under: Web / Software Development

This is going to be the shortest post on this board, and one of the most embarrassing!

 

I ‘inherited’ a file full of string values that contained over 10,000 entries. Problem was, they were all lower case. I wasn’t about to sit there and manually capitalize the first letter of each word in the list so I thought, “Hey… just write a quick function in the program that does it for you. It should only take a few lines, right?” Well, not for me.

 

I started working on a function that read in each line, searched for the first character and capitalized it. But how would you account for some words that should not be capitalized like ‘de’ as in “Cul de Sac” or initials or abbreviations? The more I thought about it, the more complex the function got. I started worrying that I was missing something… Well, I was.

 

Like I said, it’s kind of embarrassing, but while Googling to try and make sure I covered all my bases, I came across this gem on the MSDN site:

 

myString = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase( myString );

 

I couldn't believe it. It takes care of all automatic capitalization of the first letter of a word or string of words... Ugh! Oh well, I hope at least it saves some developer an hour of headaches!

Bookmark and Share DotnetKicks dotnetshoutout

What’s new in Visual Studio 2010

By Alan S. at January 27, 2010 04:36
Filed Under: Web / Software Development

Just one year ago I upgraded Visual Studio 2005 to Visual Studio 2008. There were a number of enhancements that are ‘behind the scenes’ and some notable improvements to intellisense and AJAX, which motivated me to finally upgrade. Well, that and support for .NET 3.5. But it seems that just as soon as I upgraded I started receiving information about Visual Studio 2010.

 

I took some time to research the product (still in Beta) to see if the list of changes was significant enough to warrant me spending another couple hundred bucks on yet another upgrade. Here’s some of the things I found.

 

Code Editor

The new Code Editor makes code easier to read. You can zoom in on text by pressing CTRL and scrolling with the mouse wheel. Also, when you click a symbol in Visual C# or Visual Basic, all instances of that symbol are automatically highlighted.

 

Better tools for Web Development

To me, this is reason enough to upgrade. The publishing and FTP portions of Visual Studio past were a far cry from what Dreamweaver offers. Now with enhanced publishing and rebuilding web.config on the fly, it looks like they have finally caught up.

 

  • Creating Web packages

    The Web Deployment Tool, also known as MSDeploy, enables you to package your Web application for deployment to an Internet Information Services (IIS) Web server. A Web package is a .zip file or a folder structure that includes everything a Web server needs to host your application. It contains Web content, IIS settings, database scripts, components, registry settings, and certificates. The Web Deployment Tool has been integrated into Visual Studio and enables you to create Web packages with one click.

  • One-Click Publish

    You can now publish to a server by using the Web Deployment Tool, FTP, folder copying, or FrontPage Server Extensions in one click. Visual Studio stores all the setting information, such as publish method, server information, and user credentials.

  • Web Configuration Transformations

    You can now configure your project to transform the web.config file during deployment. When you deploy the project, the settings in web.config automatically match the settings on your debug, staging, and production servers.

  •  

    It also includes something completely new:

    Visual F#

    Visual Studio 2010 includes F#, a new .NET Framework language that supports functional programming and traditional object-oriented and imperative (procedural) programming. F# combines the succinct, expressive, and compositional style of functional programming with the runtime, libraries, interoperability, and object model of .NET. In other words, you get the best of both paradigms.

     

    Right now I don’t have the time or patience to try another development product so an actual ‘hands on’ review is not coming anytime soon. For now, I’ll have to rely on what I’m reading in order to form an opinion. I think I’ll also wait for the product to go through it’s first service pack release before upgrading. Maybe by then they’ll have the kinks worked out.

    Bookmark and Share DotnetKicks dotnetshoutout


       

    eMail Scraper
    Generate email lists in seconds!


    eSource Development presents the ultimate tool for email lead generation! They have decided to release the hottest email list generation tool that allows you to get hundreds (even THOUSANDS) of specific email addresses for any genre, niche, or geographical area.

    Internet marketing companies and professionals have been using this tool for years. Now, it has been re-engineered, updated, and released to the public. This 'insider only' software was a closely guarded industry secret until recently.



    Watch the Demo

    NEW! Trial version available!

    DOWNLOAD FOR FREE




      


    Dr. Torgo's PC
    System Inventory v2.0


    Dr. Torgo's PC System Inventory offers a full range of system query options and powerful reporting tools. This software quickly generates reports on several dozen hives of system information including disks, CPU, memory, motherboard, users, ports, services, software, and MORE.

    Read more here!

    NEW! Trial version available!
    DOWNLOAD FOR FREE


    Help us out by visiting our sponsors!

    Protect Your Business







    Recent Comments

    Comment RSS

    What We're Playing





    Who's Watchin' Me?