Results 1 to 10 of 12

Thread: Code review.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #9
    Join Date
    Feb 2009

    Default Re: Code review.

    Quote Originally Posted by Michael Mullan View Post
    I'm moving an old (vdf5? vdf7?) vintage codebase from vdf16 to DF19.1, and I've run DFrefactor over it (Awesome tool, everybody should use and contribute to it!). In the code base the original developer just adored this construct:

         While (Length(sLast_Part_ID) < 4)
             Insert "0" in sLast_Part_ID at 1
    Personally I prefer

         Move (Right(Append("0000",sLast_Part_ID ),4)) to sLast_Part_ID
    Of course since the "insert" command is now a "Bad Idea"™ the compiler flags every instance.

    Does anyone else have a strong preference?
    Is your preference strong enough that you'd take the time out to change the existing while loop?
    I have a function:
    Function LPad global String stext String spadder Integer ipadno Returns String
        Move (trim(stext)) to stext
        While (Length(stext)<ipadno)    
           Move (spadder+stext) to stext
        Function_Return stext
    The advantage being that the inserted prefix can be multiple characters

    move (Lpad(string1,"0a",10)) to string1
    Last edited by DaveR; 13-Apr-2021 at 03:52 PM.
    test? it compiles doesn't it?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts