Easy way to Format Strings with Capital Inital letters in VB.NET

I am developing a web application with ASP.NET and Oracle database. In the Oracle, there is a table with a “City” field whose data is in Upper Case. To make the data look good, I format the city name in the Stored Procedure with InitCap function from Oracle as the blow:

SELECT DISTINCT INITCAP(F_city) AS CITY FROM CITY_TAB
ORDER BY CITY ASC;

Now, I need to accomplish the same in my VB.NET code. Of course, based on my previous knowledge I was not aware of  such String Function in VB.net the similar as the INITCAP. And I used to write a function to loop all strings and put the first letter in Capital when we were coding in VB script (ASP).

This week, I found out a easy way to do so in ASP.NET. Now you can use StrConv to get the formatted string. For example:

Dim strCity as String = strConv(strCity, vbstrconv.vbproperCase)

Enjoy programming!

  • Share/Bookmark
Tags:

Related posts

2 Responses to “Easy way to Format Strings with Capital Inital letters in VB.NET”


  • Hi, WebGuru,

    Just saw you added your blog in LinkedIn. So here I am to visit it. It is very nice. You certainly update your blog quite often. Hope we can exchange ideas and information more often.

    Jack

    [Reply]

    超凡不脱俗 replied on July 22nd, 2009:

    Welcome. Sure, we can definitely exchange the IT news and ideas via blogging. Take Care.

    [Reply]

  • Gratis Film Downloaden

    I cannot believe this will work!

    [Reply]

Leave a Reply