# Thread: find how many digits are in number.

1. Registered User
Join Date
Dec 2003
Location
Belfast, UK
Posts
87

## Unanswered: find how many digits are in number.

Hi,

can anyone tell me how to find out how many digits are in a number?

example if the number is 20 then the returned value is 2 if it's 123 then 3 and so on. what I need to do is add a number of 0s depending on how many numbers are available.

something like this.

value(number of digits in [string])

select case value
case 1
value = 000 & string
case 2
value = 00 & string
case 3
value = 0 & string
end case

thanks for all suggestions.

2. Registered User
Join Date
Aug 2003
Posts
106

## LEN function

You can use the LEN function.

For example:

LEN(20) = 2

LEN(20000) = 5

hope this helps,

sugarflux

3. Purveyor of Discontent
Join Date
Mar 2003
Location
The Bottom of The Barrel
Posts
6,102
Provided Answers: 1

## Re: find how many digits are in number.

Originally posted by bertthefreak
Hi,

can anyone tell me how to find out how many digits are in a number?

example if the number is 20 then the returned value is 2 if it's 123 then 3 and so on. what I need to do is add a number of 0s depending on how many numbers are available.

something like this.

value(number of digits in [string])

select case value
case 1
value = 000 & string
case 2
value = 00 & string
case 3
value = 0 & string
end case

thanks for all suggestions.
You might want to look into display formats..

eg, if you have a field containing "1" and you need it to display "0001", put "0000" into the format property of whatever text box you're pumping the field into and it will add the zeros for you if necessary.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•