udfStrCenter
str udfStrCenter (str, int, str)
;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfStrCenter (strString, intLength, strPad)
strString = StrSub (strString, 1, intLength)
Return StrFix (StrFixLeft (strString, strPad, (StrLen (strString) + intLength) / 2), strPad, intLength)
;..........................................................................................................................................
; This UDF "udfStrCenter" returns a string of intLength width
; with the input string centered and padded with pad character.
;..........................................................................................................................................
; Detlev Dalitz.20010729.20030209
;..........................................................................................................................................
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------


; Test.

strTest1 = udfStrCenter ("Title"   ,  3, "*") ; "Tit"
strTest2 = udfStrCenter ("Title"   ,  5, "*") ; "Title"
strTest3 = udfStrCenter ("Title"   ,  6, "*") ; "Title*"
strTest4 = udfStrCenter ("Title"   ,  7, "*") ; "*Title*"
strTest5 = udfStrCenter ("Title"   , 12, "*") ; "***Title****"
strTest6 = udfStrCenter ("Title"   , 12, "" ) ; "   Title    "
strTest7 = udfStrCenter ("Title   ", 12, "" ) ; "  Title     "
strTest8 = udfStrCenter ("Title   ", 12, "*") ; "**Title   **"
Exit
;------------------------------------------------------------------------------------------------------------------------------------------