2014년 12월 6일 토요일

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!

thx! (Y) :)



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



I "programm" the quiz App (https://puravidaapps.com/quiz.php), and it works. But now I try to change the "result.lbl"! is it possible, after all question, to show the questions one after another with the buttons AND show the right and wrong answer on the Button? Red Button is wrong answer, green Button right answer, if the answer was right only the green button. is it possible? thank you.



yes, you can
you know where to find the questions, the answers, the correct answer for each question and the given answer for each question

after doing the tutorials and learning the basics you should be able to find this out yourself
try something and if you get stuck, post a screenshot of your relevant blocks


댓글 없음:

댓글 쓰기