I have an extract from my code which shows Regex.split forming a list.
The list is tested at item 14 for a specific value and if not found
I want to INSERTAT a default value.
I keep getting error with whatever I try to use with InsertAt...
Could someone please show me how to use the InsertAt in the List.
Error shown is...
The list is tested at item 14 for a specific value and if not found
I want to INSERTAT a default value.
I keep getting error with whatever I try to use with InsertAt...
Could someone please show me how to use the InsertAt in the List.
B4X:
Private Sub DecodeResults(line As String)
Dim FrmLst As List
Dim str1 As String
Dim group As String
Dim x As Int
Dim NoSect As Object
NoSect = "(0)"
' <strong><font color="#0000FF">7-12* </font></strong>
' 11.1L, M.V., 10Fe12, 1519m, 3yo+ Mdn, Mdn 3+, (2), $30000 ($350), Good, K L Bradley, 4, Cd 58.5, (SW), 1:31.63, (36.97), 20/1, S 7, 12 -, 8 8, T 4, 1-Accrual 58.0<br>
'group = "11.1L, M.V., 10Fe12, 1519m, 3yo+ Mdn, Mdn 3+, (2), $30000 ($350), Good, K L Bradley, 4, Cd 58.5, (SW), 1:31.63, (36.97), 20/1, S 7, 12 -, 8 8, T 4, 1-Accrual 58.0"
' Missing 'SECT'...
group = "11.1L, M.V., 10Fe12, 1519m, 3yo+ Mdn, Mdn 3+, (2), $30000 ($350), Good, K L Bradley, 4, Cd 58.5, (SW), 1:31.63, 20/1, S 7, 12 -, 8 8, T 4, 1-Accrual 58.0"
FrmLst = Regex.Split(",", group)
Log("FrmLst " & FrmLst.Size) ' usually 21 items
' somtimes 'SECT' is missing from Country tracks
If FrmLst.Size < 21 Then
' possibly 14 Is Not a Sect but Tote Odds
str1 = FrmLst.Get(14)
Log("NO SECT " & str1)
' if it has odds it will be like: ' 4/1'
' check for '/'
x = str1.IndexOf("/")
If x > -1 Then
' we have odds in 14
' insrt a default 'Sect' Value - "(0)"
' ERROR - InsertAt --------------------------------------------------------------
' FrmLst.InsertAt(14,"(0)")
' FrmLst.InsertAt(14, NoSect)
' FrmLst.InsertAt(14, Array As Object(NoSect))
End If
End If
End Sub
B4X:
FrmLst 20
NO SECT 20/1
importer_decoderesult (B4A line: 393)
FrmLst.InsertAt(14,"(0)")
java.lang.UnsupportedOperationException
at java.util.AbstractList.add(AbstractList.java:411)
at anywheresoftware.b4a.objects.collections.List.InsertAt(List.java:102)
at bpak.get.file.list.importer._decoderesult(importer.java:345)
at bpak.get.file.list.importer._readhorseresults(importer.java:2266)
at bpak.get.file.list.importer._readhorseform(importer.java:1924)
at bpak.get.file.list.importer._readhtmlfile(importer.java:2354)
at bpak.get.file.list.importer._doracelist(importer.java:1143)
at bpak.get.file.list.main._btnreadlist_click(main.java:684)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:167)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:155)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:151)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:59)
at android.view.View.performClick(View.java:2485)
at android.view.View$PerformClick.run(View.java:9080)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
java.lang.UnsupportedOperationException