pCase 函数源程序

发表于:2007-06-30来源:作者:点击数: 标签:
To call the function: mynewvar = PCasefunc(txtFieldName) % Function PCase(strInput) Dim iPosition @# Our current position in the string (First character = 1) Dim iSpace @# The position of the next space after our iPosition Dim strOutput @#
To call the function:
mynewvar = PCasefunc(txtFieldName)

<%
Function PCase(strInput)
Dim iPosition @# Our current position in the string (First character = 1)
Dim iSpace @# The position of the next space after our iPosition
Dim strOutput @# Our temporary string used to build the function@#s output

iPosition = 1

Do While InStr(iPosition, strInput, " ", 1) <> 0
iSpace = InStr(iPosition, strInput, " ", 1)
strOutput = strOutput & UCase(Mid(strInput, iPosition, 1))
strOutput = strOutput & LCase(Mid(strInput, iPosition + 1, iSpace - iPosition))
iPosition = iSpace + 1
Loop

strOutput = strOutput & UCase(Mid(strInput, iPosition, 1))
strOutput = strOutput & LCase(Mid(strInput, iPosition + 1))

PCase = strOutput
End Function
%>

原文转自:http://www.ltesting.net