Quote:
This is working
Are you sure ?
string subject = "TestTest - CustID : 1200005#14102016_0412- ARF"
if (subject.Trim().Contains("CustID"))
{
if (subject.Trim().Contains(CustomerID:))
{
customerId = ExtractFromString(mailSubject, "CustomerID:","#");
}
else if (subject.Trim().Contains(CustID:))
{
customerId = ExtractFromString(mailSubject, "CustomerID:","#");
}
}
I see 2 syntax errors, 3 misuse and at 4 error of logic.
And from the code, I suspect the example to not be complete.
I expect 2 main examples with optional spaces.
it stings my eyes.
So what is the question and the problem ?
[UpDate]
When I see your new code:
if (subject.Trim().Contains("CustID"))
{
customerId = ExtractFromString(mailSubject, "CustID:","#");
}
else if (subject.Trim().Contains(CustID:))
{
customerId = ExtractFromString(mailSubject, "CustID:","#");
}
}
You do not understand what this code does, it can't be yours, it do not even compile !
Advice: Learn properly C#