VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Adding zeros either in the left or right of the number depends on how many zeros you want to add. (

by Choti (2 Submissions)
Category: String Manipulation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 10th July 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Adding zeros either in the left or right of the number depends on how many zeros you want to add. (i.e. 756 = 0000756 or 75600)

Rate Adding zeros either in the left or right of the number depends on how many zeros you want to add. (



Dim lenctr As Integer
    lenctr = 0
    Do While num_len - Len(Trim(v_num)) <> lenctr
        addzero = addzero + "0"
        lenctr = lenctr + 1
    Loop
    if pos = 0 then   'position of zeros are in left
         addzero = addzero + Trim(v_num)
       else           ' position of zeros are in right
         addzero = Trim(v_num) + addzero
    endif
End Function

Download this snippet    Add to My Saved Code

Adding zeros either in the left or right of the number depends on how many zeros you want to add. ( Comments

No comments have been posted about Adding zeros either in the left or right of the number depends on how many zeros you want to add. (. Why not be the first to post a comment about Adding zeros either in the left or right of the number depends on how many zeros you want to add. (.

Post your comment

Subject:
Message:
0/1000 characters