This is my example of some string:
- message: this is some message 2. message: this is some message 3. message: this is message which i want to see only in results
according to this example I would like to get result:
this is message which i want to see only in results
there might be multiple x. message:
sentences in my string.
I want to delete those message which are duplicated
any idea?
ADDED:
My question is regarding some selling tool and printing reports. Code I running now looks like this:
private void OnBeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
string a = xtraReport1.GetCurrentColumnValue("Paczka_Notatki").ToString();
xrTableCell3.Text = a;
}
when I change it to:
private void OnBeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
var str = xtraReport1.GetCurrentColumnValue("Paczka_Notatki").ToString();
foreach (var message in Regex.Split(str, @"\d+\. message: ")
.GroupBy(m => m)
.Where(m => m.Count() == 1 && m.Key != string.Empty)
.Select(m => new { message = m.Key }))
{
xrTableCell3.Text = message.message;
}
}
then I have got a lot of errors like:
String text = xtraReport1.GetCurrentColumnValue("Paczka_Notatki").ToString();
string finalNote = "";
string[] notes = System.Text.RegularExpressions.Regex.Split(text, @"\d{1,}\.\smessage:(?<Message>[\D\s]+)");
foreach (string note in notes)
{
if (!String.IsNullOrEmpty(note) && finalNote.IndexOf(note) == -1)
finalNote += note;
}
xrTableCell3.Text = finalNote;
thank you guys for support !!!