2014년 12월 1일 월요일

read txt file and seperate the lines by ":" or "," ...

im trying to develop an quiz-app.
I hope there is someone can help me... -_-

the function would be:

read a txt file from web (if possible without saving on smartphone)

txt file structure: 

What ist the capital city of germany? :Berlin :Muenchen :Duesseldorf :Mainz
many
other
questions
...

The ap looks like:

What ist the capital city of germany?

checkbox1_Berlin
checkbox2_Muenchen
checkbox3_Duesseldorf
checkbox4_Mainz

is it possible to seperate the lines in the txt file by ":" and change the checkbox_text to the possible answer?



yes, you can read the text file with the web component and the gotText event
let me recommend to use 2 files, a file for the questions and another file for the answers (in csv format)

Berlin,Muenchen,Duesseldorf,Mainz

then you can convert the csv format into a list of lists using the list from csv table block
have you already seen this example? https://puravidaapps.com/quiz.php
You could adjust it to your needs...



Hi Taifun, thx for your response!
I will try it and report!



I used the "list from csv table block" it works but the questions are in ()

another question: how can I read the question file AND answer file and do the result in various textboxes?



currently you are getting a list of lists, each item of the main list is another list which has 1 item

if you want to import a 1 column csv table as i this case, I recommend you to use the split at block and split at \n (new line) to get a simple list of the questions

another question: how can I read the question file AND answer file and do the result in various textboxes?
see again my example https://puravidaapps.com/quiz.php how this works for buttons, now adjust it to use checkboxes instead of buttons...

first do the tutorials http://appinventor.mit.edu/explore/ai2/tutorials.htmlto learn the basics of App Inventor, then try something and follow the


댓글 없음:

댓글 쓰기