
Most efficient way to strip leading zeros from string
This method will work as long as the number is no more that 15 digits.
If sValue = "012345" then try this:
sValue = CStr(Val(sValue))
Actually you don't even need the CStr if sValue has been declared as
Dim sValue as String
Quote:
> Hi,
> I'm a former FoxPro programmer working on a VB utility.
> I'm hoping that somebody could suggest the best way to
> take a six character string (ie: "015676"), strip the
> leading zero(s) and end up once again with a character
> string.
> Through FoxPro I would have probably done a substr() and
> include some code to pull out everything to the right of
> the first zero in the string but I'm not very familiar
> with VB Syntax and commands yet. I am working on it
> though.....
> Any sugesstions would be greatly appreciated.
> Thanks.
> PS. If I should have posted this in another topic, please
> let me know.