How to split this string and identify first sentence after last '*'?
- by DaveDev
I have to get a quick demo for a client, so this is a bit hacky. Please don't flame me too much! :-)
I'm getting a string similar to the following back from the database:
The object of the following is to do:
* blah 1 * blah 2 * blah 3 * blah 4. Some more extremely uninteresting
text. Followed by yet another sentence
full of extrememly uninteresting text.
Thankfully this is the last sentence.
I need to format this so that each * represents a bullet point, and the sentence after the last * goes onto a new line, ideally as follows:
The object of the following is to do:
blah 1 (StackOverflow wants to add bullet points here, but I just need '*')
blah 2
blah 3
blah 4.
Some more extremely uninteresting
text. Followed by yet another sentence
full of extrememly uninteresting text.
Thankfully this is the last sentence.
It's easy enough to split the string by the * character and replace that with <br /> *. I'm using the following for that:
string description = GetDescription();
description = description.Replace("*", "<br />*"); // it's going onto a web page.
but the result this gives me is:
The object of the following is to do:
blah 1
blah 2
blah 3
blah 4. Some more extremely uninteresting text. Followed by yet
another sentence full of extrememly
uninteresting text. Thankfully this is
the last sentence.
I'm having a bit of difficulty identifying the fist sentence after the last '*' so I can put a break there too. Can somebody show me how to do this?