add zeros to number

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i have a number and want to convert it to a text field and add HE and zeros
so all numbers are 12 digits. For example
Start end

1234 HE0000001234
45399 HE0000045399
339987 HE0000339987
 
dlb1228 said:
i have a number and want to convert it to a text field and add HE and zeros
so all numbers are 12 digits. For example
Start end

1234 HE0000001234
45399 HE0000045399
339987 HE0000339987

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format(1234,"\HE" & String(12,"0"))

The H has to be escaped "\" to avoid confusion w/ the Hexadecimal
indicator.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQ/zr7oechKqOuFEgEQKN/gCggvz99LHVL8XyFmoEd/ja2ss0EVIAniJW
ce1RAu/olV0CpAZKviEkrYAi
=vRJa
-----END PGP SIGNATURE-----
 
why does it look at it as a hexadecimal? why not a text field? and
what does string do? does it convert it to a text field
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The H before a number indicates a hexadecimal number. In the Debug
window (Ctrl-G) type the following:

? format(1234,"HE00000") <hit the Enter key here>

The result will be:

0E00000

To force the Format() command to include the "H", which it thinks is a
Hexadecimal indicator, we have to put the escape character "\" before
the "H":

? format(1234,"\HE00000")

yields the following:

HE01234


The String() function repeats the indicated character the indicated
number of times. E.g.:

String(12, "0")

means repeat the character "0" 12 times. This is an easier way to
represent the 12 zeros instead of typing them and hoping I counted
correctly when typing that many zeros:

Format(1234,"\HE000000000000")

Is the same as

Format(1234,"\HE" & String(12,"0"))

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQ/4ov4echKqOuFEgEQKwrwCgyN3OFmx8sTiKNG5GDg+m9gbPkIQAoP3X
Y4weei1gRTfH+g6UYVOakWFL
=g8aJ
-----END PGP SIGNATURE-----
 
Back
Top