| | |
C# Code Question
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Aug 2006
Posts: 3
Reputation:
Solved Threads: 0
Hi!
I'm a beginner C# programmer, and our instructor has asked me to create a verification system for our web site so that a person has to complete a puzzle before they can fill out a form to submit comments on the site, etc.
What he wants us to do is to have a random sentence displayed such as "The cow jumped over the moon" or any sentence we want. I've already done this part.
But then, he wants us to make it so that the person must type in the fifth word in the sentence to complete the verification process.
My question is.. If you have a sentence like the one listed above, what code would one use to return just the fifth word in that sentence? The sentence is a string.
Hope someone can help.
From KN
I'm a beginner C# programmer, and our instructor has asked me to create a verification system for our web site so that a person has to complete a puzzle before they can fill out a form to submit comments on the site, etc.
What he wants us to do is to have a random sentence displayed such as "The cow jumped over the moon" or any sentence we want. I've already done this part.
But then, he wants us to make it so that the person must type in the fifth word in the sentence to complete the verification process.
My question is.. If you have a sentence like the one listed above, what code would one use to return just the fifth word in that sentence? The sentence is a string.
Hope someone can help.
From KN
Hi,
You can use String.Split(" ") to get an array of words of your string, this way you can also know the number of words on that string. (if you plan to use multiple possible sentences)
Loren Soth
You can use String.Split(" ") to get an array of words of your string, this way you can also know the number of words on that string. (if you plan to use multiple possible sentences)
Loren Soth
Best regards,
Loren Soth
Crimson K. Software _________________________________________________________________ Crimson K. Blog
Loren Soth
Crimson K. Software _________________________________________________________________ Crimson K. Blog
![]() |
Similar Threads
- Bad Code question (C++)
- windows code question? (Existing Scripts)
- need HELP .jpf/weblogic/jsp - with CODE (JSP)
- C question (Community Introductions)
- Basic hover code question (JavaScript / DHTML / AJAX)
- I just found this code for PAC MAN...what does this mean??? (Java)
- find out the error in my code (Java)
- Simple (I think) Code Question (PHP)
Other Threads in the C# Forum
- Previous Thread: Serialization to XML + Encryption
- Next Thread: Strings help
| Thread Tools | Search this Thread |
.net access ado.net algorithm array barchart bitmap box broadcast brush buttons c# chat check checkbox client color combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees development draganddrop drawing encryption enum event excel file files form format forms function gdi+ httpwebrequest image index input install java label list listbox listener mandelbrot math mouseclick mysql networking object operator path photoshop picturebox pixelinversion post prime programming radians regex remote remoting richtextbox round save saving serialization server sleep socket sql statistics stream string table tcp text textbox thread time timer treeview update usercontrol validation view visualstudio webbrowser windows winforms wpf xml





