Skip to main content
Inspiring
June 16, 2008
Question

Adding dashes in output

  • June 16, 2008
  • 6 replies
  • 521 views
Hi,

This should be an easy one...

I have a 12-digit number and I would like it to appear as:
5555-5555-5555

What would be the best way to do this? The number is always 12 digits.

Thanks!
    This topic has been closed for replies.

    6 replies

    ltherAuthor
    Inspiring
    June 17, 2008
    Thanks to all of you.

    I wish I'd seen your reply earlier Michael - I spent a bit of time staring at it to figure out why it was acting odd. :)

    And you're right Azadi - thanks!
    ltherAuthor
    Inspiring
    June 16, 2008
    I went back and tried something. It seems to be working so I'll go with that.

    Thanks.
    Known Participant
    June 16, 2008
    Typo alert:

    You have part1 = left...
    part2 = right...
    part3 = mid...

    so you need to concatenate the strings "part1" & "part3" & "part2" (132 rather than 123)

    Michael
    ltherAuthor
    Inspiring
    June 16, 2008
    Hi Steve - I'm just not sure of how to use that function for this purpose. Thanks.
    Inspiring
    June 16, 2008
    What do you mean by 'not getting anywhere'? Are you getting an error??

    "lther" <webforumsuser@macromedia.com> wrote in message
    news:g36fi1$lo8$1@forums.macromedia.com...
    > Thanks for trying but unfortunately I'm not getting anywhere with that.
    >
    > If anyone knows how I could do this specifically it would really help out.
    >
    > Thanks!


    ltherAuthor
    Inspiring
    June 16, 2008
    Thanks for trying but unfortunately I'm not getting anywhere with that.

    If anyone knows how I could do this specifically it would really help out.

    Thanks!
    Inspiring
    June 16, 2008
    Use the left, mid, and right functions. Details are in the cfml reference manual. If you don't have one, the internet does.