Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42406

Cell Phone Format

$
0
0
the below code doesnt give me correct results...am missing a vb.net syntax...no error though



Code:


Public Shared Function TSTIDM_Format_Cell_Number(ByVal str As String) As String
 
        'remove all characters except integer
        str = Regex.Replace(str, "[^0-9]", "")
                str = str.Replace(" ", "")
                str = str.trim()
               
        If str.Substring(0,2) ="90" AndAlso str.Length = 12 Then       
            str = str.Substring(2,10)         
                ElseIf str.Substring(0,1) ="9" AndAlso str.Length.Equals(11)
                        str = "0" + str.Substring(1,10)
                ElseIf str.Substring(0,1) = "0" AndAlso str.Length.Equals(11)
            str = str.Substring(0,11)
        ElseIf str.Substring(0,1) <> "0" AndAlso str.Length.Equals(10)
                        str = "0" + str
                Else
                        str = str
        End If
       
        Return str
End Function

--------------------------------------------------------------------------------


Viewing all articles
Browse latest Browse all 42406

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>