Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2004
    Location
    Cowfields of Germany
    Posts
    617

    manipulate string

    how can i search a string and return the value between 2 values?

    example:
    Code:
    question_list [1] = "What's between 4 and 6?\n\nA - 1.\n\nB - 3.\n\nC - 5.\n\nD - 7.";
    I want to populate an input box with the value between \n\nC - and \n\nD. How can i do that? what i'm doing is using 5 input boxes, 1 to show the question and 4 to show the answers and letting the user edit test files. i was using excel for this but i wanted to make it easier. i didnt want the user to have to deal with the Scripting code, only the questions and answers.

    any suggestions?

    chris

  2. #2
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    Is there a reason you are trying to do it all in one string? Why not use the table to seperate it for you.

    Code:
    question_list = {};
    question_list[1].Question = "What's between 4 and 6?";
    question_list[1].AnswerA = "A - 1."
    question_list[1].AnswerB = "A - 3."
    question_list[1].AnswerC = "A - 5."
    question_list[1].AnswerD = "A - 7."
    question_list[1].Correct = "C"

  3. #3
    Join Date
    Feb 2004
    Location
    Cowfields of Germany
    Posts
    617
    i originally used some of the code from the sample quiz in ams5. i put a sample here on the forum a few weeks ago for someone else that very similar to what you just posted but i was hoping not to have to change the test formats. i'm going to anyways just to save myself time and Advil.

    thanks Worm

    chris

  4. #4
    Join Date
    Feb 2004
    Location
    Cowfields of Germany
    Posts
    617
    Quote Originally Posted by Worm
    Is there a reason you are trying to do it all in one string? Why not use the table to seperate it for you.

    Code:
    question_list = {};
    question_list[1].Question = "What's between 4 and 6?";
    question_list[1].AnswerA = "1."
    question_list[1].AnswerB = "3."
    question_list[1].AnswerC = "5."
    question_list[1].AnswerD = "7."
    question_list[1].Correct = "C"
    hey Worm, if i wanted to have a True or False question in this test, could i just add this to each question to tell the program to hide the unused buttons?
    Code:
    question_list[1].TorF = "0" -- 0 is for multiple choice
    question_list[1].Question = "What's between 4 and 6?";
    question_list[1].AnswerA = "A - 1."
    question_list[1].AnswerB = "A - 3."
    question_list[1].AnswerC = "A - 5."
    question_list[1].AnswerD = "A - 7."
    question_list[1].Correct = "C"
     
    question_list[2].TorF = "1" -- 1 is for true or false
    question_list[2].Question = "4 = 6?";
    question_list[2].AnswerA = "True."
    question_list[2].AnswerB = "False."
    question_list[2].AnswerC = ""
    question_list[2].AnswerD = ""
    question_list[2].Correct = "B"
    i would like to have mixed tests if i could. i'm already using the TorF function to set up the bottons for the entire test. i would like to be able to set the buttons for each question.

    thanks for any suggestions

    chris

  5. #5
    Join Date
    Feb 2004
    Location
    Cowfields of Germany
    Posts
    617
    i figured it out. here is a sample of it. not much here. i just wanted to be able to hide objects (buttons) if the question was true or false so the user wouldnt click the unused buttons. now i'm going to have it change the text on the buttons to display T or F also.

    thanks Worm! your code you posted helped alot.

    chris

    also, this sample is in AMS 5. i only have version 5 at work.
    Attached Files

Similar Threads

  1. Function : Validate String (Great for passwords, etc.)
    By Corey in forum AutoPlay Media Studio 5.0 Examples
    Replies: 3
    Last Post: 04-28-2005, 02:42 AM
  2. attempt to index a string value
    By csd214 in forum AutoPlay Media Studio 5.0
    Replies: 8
    Last Post: 08-08-2004, 01:23 AM
  3. "Get Delimited String" -- Delimiter can be a string?
    By Bishal in forum Setup Factory 6.0
    Replies: 1
    Last Post: 10-16-2003, 10:40 AM
  4. replace a character in a string
    By boudie in forum Setup Factory 6.0
    Replies: 7
    Last Post: 06-10-2003, 08:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts