HI. I would like to know the steps to make the text (automatically) of the fifth word in any given sentence (assuming sentences have more than five or more words) to be in italic form by counting characters or strings (making the first character as the starting point). I have no knowledge about programming, please explain the steps in layman's terms. Thanks.
Loading
Sam HobbsPosted Jun 7, 2011, 10:47 PM
Sam HobbsPosted Jun 7, 2011, 10:36 PM
There are many details that affect the answer; specifically where the data is coming from and where it is going to. Making text italicized depends on the formatting used for the text. The formatting is done using a format such a Microsoft Word format or HTML format. A database does not make data italicized except for the formatting provided by a format such as Word or HTML.
So a little bit more about the requirements is needed before anything specific can be said.
The following is sample code to get the fifth word of a file of words. It won't help you very much but there is not much that I know about what you need.
String[] WordArray;
char[] Delimiters = new char[2];
Delimiters[0] = ' ';
Delimiters[1] = '\t';
using (StreamReader sr = new StreamReader(@"words.txt"))
{
while (!sr.EndOfStream)
{
Words = sr.ReadLine();
WordArray = Words.Split(Delimiters, StringSplitOptions.RemoveEmptyEntries);
Console.WriteLine(WordArray[4]);
} }