Thread: Integer Problem
View Single Post
  #4 (permalink)  
Old October 27th, 2006, 09:47 AM
pjm pjm is offline
Authorized User
Join Date: Jul 2006
Location: Boston, MA, USA.
Posts: 70
Thanks: 0
Thanked 0 Times in 0 Posts

I can do that in one swell foop (if you like slightly obfuscated code):

       str = right(string(n,"0") & trim(str(val(s)+1)),4)

where s is your original string and n is the desired length.

Note that when you use the str function to convert a number to a string it will return a string with a leading blank (hence the trim function).

Reply With Quote