To read the article online, visit http://www.4GuysFromRolla.com/webtech/092798-1.shtml

Capitalizing each Word in a Sentence using ASP

The time may arise that you want an Active Server Pages algorithm to capitalize each letter of a word in a sentence or paragraph. Well, here is the code to do just that, from Microsoft's Support (http://www.microsoft.com/support). Happy Programming!

 ``` Function Capitalize(str) 'This function capitalizes each of the words in a sentence. Dim t t = str If t <> "" Then t = UCase(Mid(t, 1, 1)) & Right(t, Len(t) - 1) For i = 1 To Len(t) - 1 If Mid(t, i, 2) = Chr(13) + Chr(10) Then ' Capitalize words preceded by carriage return plus ' linefeed combination. t = Mid(t, 1, i) & UCase(Mid(t, i + 2, 1)) & Mid(t, i+3, Len(t)) End If If Mid(t, i, 1) = " " Then ' Capitalize words preceded by a space: t = Mid(t, 1, i) & UCase(Mid(t, i + 1, 1)) & Mid(t, i+2, Len(t)) End If Next End If Capitalize = t End Function ```

 Article Information Article Title: Capitalizing each Word in a Sentence using ASP Article Author: Scott Mitchell Published Date: Sunday, September 27, 1998 Article URL: http://www.4GuysFromRolla.com/webtech/092798-1.shtml