|
-
Aug 15th, 2002, 07:08 PM
#1
Thread Starter
Lively Member
Info in " "s into a string from Richtextbox.
This is a bit hard to explain so please bar with me. I have a richtext box where the user types in commands. When the user
types in the command print "some text here" I need to be able to put the text in " " 's into a string. For the life of me I cant find a way to do this. Even if your not sure please post. Any idea's are welcome.
12/32/84 - I need some code to make me a sandwhich.
-
Aug 16th, 2002, 09:00 PM
#2
PowerPoster
A quick and dirty way would be to use the string.split function.
You pass in a character to split at, in this case an ", then you get an array of strings back.
You can then go through the array and look for the word print in the elements. If the print word is in index 10, that would mean you need to print out index 11.
Or another way that will require a little more coding, but not much, would be to use the instring function and the substring functions. First you would look for the word 'print' in the string with the instr function. When if finds it, it will return an index of where that string is. You add 6 or 7 to that number, and you should be at the start of the string to print. Now you would need to start looking from there with the instr function to find the next quote. That would be the ending point of the string you need to print. You figure out the length by subtracting the start from the end. Now, you use the substring function and pass in where to start, and the length, and you will get the string you need to print.
Hope that helps. If you need me to, when I have the time I can go ahead and write out the code for you.
-
Aug 16th, 2002, 09:49 PM
#3
Thread Starter
Lively Member
I would really appreciate it if you could write out a code example for me. I understand what your saying but without seeing an example I'm lost.
Thanks for your time.
12/32/84 - I need some code to make me a sandwhich.
-
Aug 16th, 2002, 10:24 PM
#4
New Member
-
Aug 17th, 2002, 10:51 AM
#5
Thread Starter
Lively Member
Yeah we're doing the same thing. Well kinda of. Im trying to recreate an old language for windows.
Thanks for the code!
12/32/84 - I need some code to make me a sandwhich.
-
Aug 18th, 2002, 01:28 PM
#6
New Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|