Douglas Farias Expert Licensed User Longtime User Apr 30, 2014 #1 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?
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 Apr 30, 2014 #2 something like this: after each line read, check if not -999: Code: Copy 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
something like this: after each line read, check if not -999: Code: Copy 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
Erel B4X founder Staff member Licensed User Longtime User May 1, 2014 #4 Use File.ReadMap: Code: Copy Dim m As Map = File.ReadMap(...) Log(m.Get("casa")) Log(m.Get("teste")) Upvote 0