Home All Groups Group Topic Archive Search About
Author
13 Apr 2006 8:35 PM
rodchar
hey all,
how do i take a string like "123456789"
and format it like this: "123-45-6789"

thanks,
rodchar

Author
13 Apr 2006 9:35 PM
Homer J Simpson
"rodchar" <rodc***@discussions.microsoft.com> wrote in message
news:A37AF431-714B-4941-8325-9993EDA72F9D@microsoft.com...

> how do i take a string like "123456789"
> and format it like this: "123-45-6789"

Should be something like Format$("123456789", "###-##-####")

Note that if this is a SSN it is a string, not a number.
Author
14 Apr 2006 12:47 AM
Steve_Black
Try Format("123456789","@@@-@@-@@@@")
Author
14 Apr 2006 2:17 AM
Homer J Simpson
<Steve_Bl***@EagleCCI.com> wrote in message
news:1144975659.077768.73090@i40g2000cwc.googlegroups.com...
>
> Try Format("123456789","@@@-@@-@@@@")

That works in VB6 but they've dumped it in VB .Net. It's an SOB to find the
replacement.
Author
14 Apr 2006 3:55 AM
Homer J Simpson
"rodchar" <rodc***@discussions.microsoft.com> wrote in message
news:A37AF431-714B-4941-8325-9993EDA72F9D@microsoft.com...

> hey all,
> how do i take a string like "123456789"
> and format it like this: "123-45-6789"

Dim S As String = "123456789"
If Len(S) = 9 Then S = Mid(S, 1, 3) & "-" & Mid(S, 4, 2) & "-" & Mid(S, 6,
4)
Author
14 Apr 2006 1:04 PM
rodchar
thanks everyone.

Show quoteHide quote
"rodchar" wrote:

> hey all,
> how do i take a string like "123456789"
> and format it like this: "123-45-6789"
>
> thanks,
> rodchar