vbscript - remove decimal and leading zeros -


below vbscript populates field called lot. @ moment when run lot field displaying manuallot field 123456.000000.

does know how can change code below make 123456.000000 0000123456? removes .000000 , starts 0000 instead.

function manuallot_onafterchange()   if backflushing.codeobject.quantity < 0     backflushing.codeobject.lot = backflushing.codeobject.manuallot   else     if backflushing.codeobject.quantity > 0       backflushing.codeobject.lot = 0     end if   end if end function 

you use split() value left of decimal, , use left() stick zeros in front of it.

'how long number should testlength=10  'the number changing test="12345.00000"  'split(test, ".")(0) values left of decimal test=left("000000000000",  testlength-len(split(test, ".")(0))) & split(test, ".")(0)  msgbox(test) 

Comments

Popular posts from this blog

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -