Capitalize the first letter

This is a very simple ASP function that will capitalise the first letter of the input string. Some time user do enters his/her name as with out capatalising first letter of the name. So this function can take care of whether a use enters name as “david” or “DAVID” and this function will make it more readable like “David”.

'*******************************************************
'*     MYCPLUS Sample Code - http://www.mycplus.com     *
'*                                                     *
'*   This code is made available as a service to our   *
'*      visitors and is provided strictly for the      *
'*               purpose of illustration.              *
'*                                                     *
'* Please direct all inquiries to saqib at mycplus.com *
'*******************************************************

Function InitCap(sStr)
  InitCap = UCase(Left(sStr,1)) & LCase(Right(sStr,Len(sStr)-1))
End Function 

Leave a Reply