Code: Select all
If OpenFile(0,dir$+"/1.html")
Repeat
r$ = ReadString(0)
res = FindString(r$,"Tel: ")
Print(res) ; This is the syntax error, how to fix it?
Until Eof(0)
Code tags added
28.12.2015
RSBasic
Code: Select all
If OpenFile(0,dir$+"/1.html")
Repeat
r$ = ReadString(0)
res = FindString(r$,"Tel: ")
Print(res) ; This is the syntax error, how to fix it?
Until Eof(0)
Code: Select all
If OpenFile(0,dir$+"/1.html")
Repeat
r$ = ReadString(0)
res = FindString(r$,"Tel: ")
PrintN(Str(res)) ; Print and PrintN want a string, res is a number
Until Eof(0)
There are many output options, depending on your requirements. Here are some of them:zer0c0de wrote:Print(res) ; This is the syntax error, how to fix it?
Code: Select all
Albert Einstein, Tel: 5551234
Isaac Newton, Tel: 5552345
Charles Darwin, Tel: 5554567
Guglielmo Marconi, Tel: 5555678
Galileo Galilei, Tel: 5556789
Leonardo da Vinci, Tel: 5557890
René Descartes, Tel: 5558901
Thomas Edison, Tel: 5559012
Code: Select all
If OpenFile(0, "PhoneNumbers.txt")
Repeat
r$ = ReadString(0)
res = FindString(r$, "Tel:")
Debug Mid(r$, res + 5, 7)
Until Eof(0)
CloseFile(0)
EndIf
Code: Select all
If OpenFile(0, "PhoneNumbers.txt")
If OpenConsole("Phone Numbers")
Repeat
r$ = ReadString(0)
res = FindString(r$, "Tel:")
PrintN(Mid(r$, res + 5, 7))
Until Eof(0)
CloseFile(0)
Input()
EndIf
EndIf
Code: Select all
wFlags = #PB_Window_SystemMenu | #PB_Window_ScreenCentered
OpenWindow(0, #PB_Any, #PB_Any, 200, 300, "Phone Numbers", wFlags)
ButtonGadget(0, 10, 10, 180, 30, "READ FILE")
ListViewGadget(1, 10, 50, 180, 240)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
appQuit = 1
Case #PB_Event_Gadget
Select EventGadget()
Case 0
If OpenFile(0, "PhoneNumbers.txt")
Repeat
r$ = ReadString(0)
res = FindString(r$, "Tel:")
AddGadgetItem(1, -1, Mid(r$, res + 5, 7))
Until Eof(0)
CloseFile(0)
EndIf
EndSelect
EndSelect
Until appQuit = 1