Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Phone number formatter tag  RSS feed

 
Rick DeBay
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone have a tag to format a phone number? It'd be nice if it had formats for the different countries, but I'll take anything.
Thanks, Rick DeBay
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Um, can you explain a little more about what you want?
I'm guessing that you have a phone number stored in a string somewhere, but presumably in a different format to how you want to see it on the page.
Can you describe these two formats for us?
 
Rick DeBay
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I grabbed a string formatter tag from somewhere and I'm using that.
My data is probably just going to be a string of numbers "8005551212". Knowing the country the number came from, I wanted to format per that countries conventions. Phone numbers have different lengths in different countries, so you can't format them for the viewers locale.
Right now I'm just using test data and formatting it as (###) ###-####. I'm hoping to get the database guy to require the data to be stored preformatted, so I don't have to transform it, as they know the country of origin when they store the number.
Rick
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm hoping to get the database guy to require the data to be stored preformatted, so I don't have to transform it, as they know the country of origin when they store the number.
I guess this is a good idea, although if there is space in the DB, storing the number "unformatted" as well might be valuable if the system is ever likely to want to auto-dial the numbers.
Glad you got something working though.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!