Android Question Read a value on txt file

Douglas Farias

Expert
Licensed User
Longtime User
how can i read a value in a string txt file?

for exemple i have a config.txt on my dirassets

in this txt have this values

casa=1
teste=5

how can i read this values

1°read a file where is casa get value last =

result = 1


where is teste i have result = 5


how can i read this value?
 

derez

Expert
Licensed User
Longtime User
something like this:
after each line read, check if not -999:
B4X:
Sub getdata(st As String) As Int
Dim str() As String
If st.Contains("casa=") Then
    str = Regex.Split("=",st)
    Return str(1)
End If
If st.Contains("teste=") Then
    str = Regex.Split("=",st)
    Return str(1)
End If
return -999
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…