|
Post by plus on May 1, 2023 19:20:35 GMT
This fixes the data file for Just Basic processing, real nice StrReplace$ routine to put in your toolbox if you don't have one (didn't find one in JB Help but might have just forgotten function name.
Open "texte.txt" for input as #1 open "fix_texte.txt" for output as #2 while eof(#1) = 0 line input #1, fl$ fix$ = StrReplace$(fl$, ",", ".") print fix$ print #2, fix$ wend close #1 close #2
Function StrReplace$(s$, replace$, new$) 'case sensitive 2020-07-28 version added to oh 3/16 for inpbs If Len(s$) = 0 Or Len(replace$) = 0 Then StrReplace$ = s$: Exit Function Else LR = Len(replace$): lNew = Len(new$) End If
sCopy$ = s$ ' otherwise s$ would get changed in QB64 p = InStr(sCopy$, replace$) While p sCopy$ = Mid$(sCopy$, 1, p - 1) + new$ + Mid$(sCopy$, p + LR) p = InStr(sCopy$, replace$, p + lNew) Wend StrReplace$ = sCopy$ End Function
Sample of fix_texte.txt
2 4134 553809.71 109294.4 3 4134 553809.71 261088.5 4 4134 553809.71 596546.55 5 4134 553809.71 765153.09 6 4134 553809.71 945645.88 7 4134 553809.71 1098595.4 8 269 22636.57 0 9 836 88250.65 0 10 1412 142086.2 0 11 2040 201485.57 0 12 3172 310327.05 0 13 3682 410080.51 0 14 4263 509798.61 0 15 4281 511128.92 0 16 4281 511128.92 7231.98 17 4281 511128.92 54029.89 18 4281 511128.92 148626.71 19 246 34372.23 0 20 668 69141.25 0
|
|
|
Post by honky on May 1, 2023 19:25:32 GMT
The commas are replaced by pointsa at loading In the zip, this is the raw text. I will look at your Codes tomorrow.
|
|
|
Post by plus on May 1, 2023 19:36:37 GMT
open "fix_texte.txt" for input as #1 while eof(#1) = 0 i = 1 LNum = LNum + 1 input #1, fl$ while word$(fl$, i) <> "" v = val(word$(fl$, i)) if v > maxn then maxn = v : saveL = LNum i = i + 1 wend wend close #1 print "The biggest number found was ";maxn;" on line ";saveL
Attachments:
|
|
|
Post by honky on May 2, 2023 7:06:41 GMT
For: tsh73: Your code has heated my brain well. With unknown and unsuspected procedures. But it works better than well. Thank you teacher, It's masterful
Thanks to "plus"for your participation
|
|