Capitalize first letter - ASP
<%
'This subroutine caps the first character of each word and makes all other characters lowercase.
'
'Example:
'
'wk_cap_input="7056 sorghum LANE"
'wk_cap_output=""
'call CapFirst
'
sub CapFirst
first_position="y"
for i=1 to len(wk_cap_input)
wk_ascii = asc(mid(wk_cap_input,i,1))
wk_char = mid(wk_cap_input,i,1)
if first_position="y" then
wk_cap_output = wk_cap_output & ucase(wk_char)
else
wk_cap_output = wk_cap_output & lcase(wk_char)
end if
first_position="n"
if wk_char = " " then
first_position="y"
end if
next
end sub
%>