USC Posted November 14, 2006 Report Share Posted November 14, 2006 Hey. I hate to ask so many questions, but I'm kinda stuck here. Alright, I'm making a "Fill in the blank program" for a friend of mine. Ideally, it's suppose to randomly take out random words from a sentence, and you have to guess what they are. Here was my thought process... 1. Load the text 2. Set a variable to a random number, between certain values. 3. Have a loop where the program goes through every letter, one at a time. If it finds a blank space, it adds one to another variable. 4. When the "blank space" variable equals the random number variable, save the current index value, then keep going until it reaches the next space. 5. Get that index value, subtract the starting index value and save the number that results. 6. Finally, do something like this... *Set TextBox2 = TextBox1.substring(Starting Index Value, Number of Characters) *Set TextBox1 = TextBox1.replace(Starting Index Value, Number of Characters, "______") ...This sets some text equal to the word we want to take out of the string (so the program can compare what you type to that). Then, it replaces it with a "_______" in the original text... ------------------------------ My problem is, I haven't been able to find an extension that allows you to go to a text Index Value. String Parser lets you save a word's index value in a counter, but I haven't been able to use that for anything. I think I have a way around it (I'll post later if anyone's interested), but it's pretty convoluted and inefficent. If anyone would help, it'd be much appreciated. Link to comment Share on other sites More sharing options...
Mark the Echidna Posted November 14, 2006 Report Share Posted November 14, 2006 If I got it right, MMF's Mid$, Left$ and Right$ functions can do that. 1 Link to comment Share on other sites More sharing options...
USC Posted November 14, 2006 Author Report Share Posted November 14, 2006 Hahaha. Believe it or not, shortly after writing that, I figured it out. Yeah, the Mid$ function on String Parsar works for what I need (I had tried it before, but for some reason got a syntax error. Weird). Still, thanks a lot for replying Mark. I was really stuck there... Link to comment Share on other sites More sharing options...
Recommended Posts