Technical Article

Proper Case function for DTS Transformation

,

This VBS function will convert a string into Proper Case (i.e. This Is Proper Case) during the execution of the DTS package.  Wrap the DTSSource function with the PropCase function and the result is a Proper Case transformation

example
Function Main()
    DTSDestination("Field1") = PropCase(DTSSource("Col019"))
    Main = DTSTransformStat_OK
End Function

Function PropCase(strLine)
Dim locArray, lcNewString, lnElement
'Make an array out of the text.Each word in an element.
locArray = Split(strLine, " ",  -1, 1)

FOR lnElement = 0 to UBound(locArray)
IF LEN(TRIM(locArray(lnElement))) > 0 THEN
IF lnElement > 0 THEN
lcNewString = lcNewString & " "
END IF
lcNewString = lcNewString & UCASE(LEFT(locArray(lnElement), 1)) & LCASE(RIGHT(locArray(lnElement), LEN(locArray(lnElement))-1))
END IF
NEXT


PropCase = lcNewString

End Function

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating