Proper Capitalization

Proper Capitalization

This code is used to capitalize the first letter of every word in a string passed as an argument.  All you have to do is past the function code near the beginning of your script command and call the function using the command PropCase(String).  Simple as that.

<%
Function PropCase(strTemp)
 Dim intFound
 Dim strTempName

 Do
   strTempName = strTempName & UCase(Left(strTemp, 1))
   strTemp     = Right(strTemp, Len(strTemp) - 1)
   intFound    = InStr(strtemp, " ")
   If intFound <> 0 Then
     strTempName = strTempName & Left(strTemp, intFound)
     strTemp = Right(strTemp, Len(strTemp) - intFound)
   Else
     strTempName = strTempName & strTemp
     Exit Do
   End If
 Loop While intFound <> 0
 Response.Write strTempName
End Function
%>

You might also like...

Comments

Scott Dennison

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The trouble with programmers is that you can never tell what a programmer is doing until it's too late.” - Seymour Cray