Format a series of number as a phone number
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2020
09:25 PM
04-29-2020
09:25 PM
Format a series of number as a phone number
How Can I Format a Series of Numbers as a Phone Number in vbscript?
ex: 4206322623 as (420) 632-2623?
Solved! Go to Solution.
2 REPLIES 2
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2020
02:11 AM
04-30-2020
02:11 AM
I didn't use VB, but...
I just found this method:
https://docs.microsoft.com/pl-pl/dotnet/api/microsoft.visualbasic.strings.split?view=netcore-3.1
so what I think you can do is split this string into an array -> and then combine it with a special sign
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2020
01:37 PM
04-30-2020
01:37 PM
Use this very simple VBScript work,
The trick is to use number as string and thus you can do your format quite easily.
Function FormatPhone(str)
FormatPhone = "(" + Left(str, 3) + ") " + Mid(str,4,3) + "-" + Right(str, 4)
End Function
But this is assuming using only US centric fixed format.
Un sourire et ça repart
