;------------------------------------------------------------------------------------------------------------------------------------------ #DefineFunction udfStrRight (strString, intLength, strPadString) If strPadString == "" Then strPadString = " " Return StrFixLeft (StrSub (strString, Max (1, StrLen (strString) - intLength), -1), strPadString, intLength) ;.......................................................................................................................................... ; This UDF "udfStrRight" returns the rightmost length characters of string. ; If string has less than length characters, the result will be padded on the left side ; with the pad string, which defaults to a blank. ;.......................................................................................................................................... ; Detlev Dalitz.20030312 ;.......................................................................................................................................... #EndFunction ;------------------------------------------------------------------------------------------------------------------------------------------ ; Test. strResult1 = udfStrRight ("abcd" , 10, "-#") ; "-#-#-#abcd" strResult2 = udfStrRight ("abcd" , 6, "*" ) ; "**abcd" strResult3 = udfStrRight ("abcdefghtest", 4, "*" ) ; "test" strResult4 = udfStrRight ("abcdefghtest", 4, "" ) ; "test" strResult5 = udfStrRight ("abcdefghtest", 15, "" ) ; " abcdefghtest" Exit ;------------------------------------------------------------------------------------------------------------------------------------------