HI, All
It seems to me, that phone number like "+41987654321" - is not a number for the database, but isNumber function = True.
Trouble is that SMS cannot be sent to a number "41...", "+41..." is required.
Any ideas to solve ?
Noting this post, maybe:
?
It seems to me, that phone number like "+41987654321" - is not a number for the database, but isNumber function = True.
Trouble is that SMS cannot be sent to a number "41...", "+41..." is required.
Any ideas to solve ?
Noting this post, maybe:
B4X:
Sub isNumber3(s As Object) As Boolean
Dim str As String = s
If IsNumber(str) Then
If str.StartsWith("+") Then
Return False
Else
Dim d As Double = str
Return d <> d + 1
End If
Else
Return False
End If
End Sub
?
B4X:
Sub JSON_CreateTableStructure(SQL As SQL, TableName As String, RowMap As Map)
If RowMap.IsInitialized = False Then Return
If RowMap.Size = 0 Then Return
Dim ft As Map:ft.Initialize
Dim field, ftype, fvalue As String
For i = 0 To RowMap.Size - 1
field = RowMap.GetKeyAt(i)
fvalue = RowMap.GetValueAt(i)
If isNumber3(fvalue) = False Then
ftype = DBUtils.DB_TEXT
Else
If fvalue.Contains(".") Then
ftype = DBUtils.DB_REAL
Else
ftype = DBUtils.DB_INTEGER
End If
End If
ft.Put(field, ftype)
Next
DBUtils.CreateTable(SQL, TableName, ft, "rowid", True) 'table in DB
End Sub