[导入]ASP常用函数:PCase()
<%
'功能:将字符串中每个单词的首字母都变为大写
'来源:http://jorkin.reallydo.com/article.asp?id=481
Private Function PCase(byVal sString)
Dim Tmp, Word, Tmp1, Tmp2, firstCt, a, sSentence, c, i
If IsNull(sString) Then
PCase = Null
Exit Function
Else
sString = CStr( sString )
End If
a = Split( sString, vbCrLf )
c = UBound(a)
i = 0
For Each sSentence In a
Tmp = Trim( sSentence )
Tmp = Split( sSentence, " " )
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
PCase = PCase & vbCrLf
End If
i = i + 1
Next
End Function
%>
文章来源:http://Jorkin.Reallydo.Com/default.asp?id=481

浙公网安备 33010602011771号