I think a slight change to the behavior of RSet() would make it a bit more intuitive and reduce redundant code.
Code: Select all
Debug RSet("1", 3, "0")
Debug RSet("12" ,3, "0")
Debug RSet("123", 3, "0")
Debug RSet("1234", 3, "0")
Debug RSet("12345", 3, "0")
Debug RSet("123456", 3, "0")
; real debug output:
; 001
; 012
; 123
; 123
; 123
; 123
; debug output I would expect:
; 001
; 012
; 123
; 234
; 345
; 456
If I know you right, then a native implementation would be fast as hell!

Code: Select all
Procedure.s _RSet(String$, Length, Character$)
ProcedureReturn RSet(Right(String$, Length), 3, Character$)
EndProcedure
Macro RSet(String, Length, Character)
_RSet(String, Length, Character)
EndMacro
Debug RSet("1", 3, "0")
Debug RSet("12", 3, "0")
Debug RSet("123", 3, "0")
Debug RSet("1234", 3, "0")
Debug RSet("12345", 3, "0")
Debug RSet("123456", 3, "0")
; debug output:
; 001
; 012
; 123
; 234
; 345
; 456