Announcement

Collapse
No announcement yet.

Forced leading padded zeroes?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Michael Mattias
    replied
    Code:
     
    W =  RIGHT$ (STRING$(fieldsize, "0") &  FORMAT$("#,", value), fieldsize)
    (It's less tortured with RSET$ but I can't recall if PB/DOS has an RSET$ ..USING function)

    Leave a comment:


  • John Gleason
    replied
    We need FORMAT$ here:
    Code:
    Red = 3122:Kount=0
    Unread= Red - Kount
    'UnreadS = USING$("#,###,###",Unread)
    UnreadS = FORMAT$(Unread, "0,000,000")
    PRINT UnreadS;" Not Read"

    Leave a comment:


  • Petr Schreiber jr
    replied
    Hi,

    did not do much tests, but for this case it worked well:
    Code:
    UnreadText = FORMAT$(Unread, "0,000,000")
    I think for 7 and less digit numbers it should work without problem.


    Petr

    Leave a comment:


  • Robert E. Carneal
    started a topic Forced leading padded zeroes?

    Forced leading padded zeroes?

    I am trying to format a result so that it contains leading zeroes, and save that to a text variable. If:

    Red = 3122:Kount=0
    Unread= Red - Kount
    Unread$ = using$("#,###,###",Unread)
    Print Unread$;" Not Read"


    Acutal Result:
    3,122 Not Read

    Preferred Result:
    0,003,122 Not Read

    Short of checking the length of Unread$ and then appending the correct number of zeroes in the front, is there a way to force the zeroes to appear using USING$ ? It shows up as nothing (i.e., correct according to format), which is correct functionally, but I would really appreciate the zeroes being padded in the front.

    Thank you.

    Robert
Working...
X