Johnmcenroy Active Member Licensed User Longtime User May 19, 2013 #1 Code: Sub ImperialMetric (Imperial As String) Dim Buffer () As String If Imperial.Contains (".") Then Buffer = Regex.Split("\.", Imperial) If Buffer(1) = Null Then Buffer(1)=0 End If End If End Sub When I write ImperialMetric (5.0) All Is fine but When I write ImperialMetric(5.) it write an error. Please help me with this problem. Thanks I found that regex function has one element just with DIM Buffer (2) As String , So i found the solution myself. There is no Buffer(1). Last edited: May 19, 2013
Code: Sub ImperialMetric (Imperial As String) Dim Buffer () As String If Imperial.Contains (".") Then Buffer = Regex.Split("\.", Imperial) If Buffer(1) = Null Then Buffer(1)=0 End If End If End Sub When I write ImperialMetric (5.0) All Is fine but When I write ImperialMetric(5.) it write an error. Please help me with this problem. Thanks I found that regex function has one element just with DIM Buffer (2) As String , So i found the solution myself. There is no Buffer(1).
Erel B4X founder Staff member Licensed User Longtime User May 20, 2013 #2 You should check Buffer.Length. Upvote 0