programming-examples/asp/Miscellaneous/PCase Function.asp

30 lines
784 B
Plaintext
Raw Normal View History

2019-11-18 14:25:58 +01:00
<%
Private Function PCase(ByVal String)
Dim Tmp, Word, Tmp1, Tmp2, firstCt, a, sentence, c, i
If IsNull(String) Then
PCase = Null
Exit Function
Else
String = CStr( String )
End If
a = Split( String, vbCrLf )
c = UBound(a)
i = 0
For Each sentence In a
Tmp = Trim( sentence )
Tmp = Split( sentence, " " )
For Each Word In Tmp
Word = Trim( Word )
Tmp1 = UCase( Left( Word, 1 ) )
Tmp2 = LCase( Mid( Word, 2 ) )
PCase = PCase & Tmp1 & tmp2 & " "
Next
PCase = Left( PCase, Len(PCase) - 1 )
If i = c Then
Else
PCase = PCase & vbCrLf
End If
i = i + 1
Next
End Function
%>