1. ## Formatting (Text /Numbers)

1)I have Account1 which is 9/10 digits(will vary) and i want it in the format the way Account2 is i.e. 12 digit format with space after every 4 digits.

case1:
Account1 = 842814859 (9 digits)
Account2 = 0008 4281 4859(12 digits)

case2:
Account1 = 4842814859 (10 digits)
Account2 = 0048 4281 4859(12 digits)

_____________________________________________

2) I have an address format that looks like this

Address1: 811 CRESTVIEW RD(2 spaces between 811 and Crestview)
Address2: 811 Crestview Rd(1 space between 811 Crestview and only C and R are capital.)

How can i do it please.........

2. ## Re: Formatting (Text /Numbers)

2) Kelly, I had posted a reply to your query about removal of spaces. Did it work? Use the replace command to get rid of the spaces and then compare. As for the capital characters problem, convert everything in address2 to uppercase using ucase.

1) Do you need to pad the 9 digit number with zeros to make it a 12 digit one or just need spaces every 4 digits and leave it as is. What I mean is a)'8428 1485 9' or b)'8428 1485 9000'

3. ## Re: Formatting (Text /Numbers)

Ok, I dont have anything better to do, here you go [img]images/icons/smile.gif[/img]

a) Without padded 0s. Will work for both 9 digit and 10 digit string

str_len = len(Account1)
str1 = Left(Account1, 4)
str2 = Mid(Account1, 5, 4)
str3 = Right(Account1, str_len - 8)
Account1 = str1&space(1)&str2&space(1)&str3

4. ## Re: Formatting (Text /Numbers)

b) For padded 0s just add the following code to the above solution:

If str_len = 9 Then
Account1 = Account1&"000"
Else
Account1 = Account1&"00"
End If

#### Posting Permissions

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

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.