Fetch string from a string using SubString function in C# and VB.Net

Last Reply 8 months ago By pandeyism

Posted 8 months ago

i have String "Key "L" work On Wed, Apr 11, 2018 at 11:07 AM, <ithelpdesk2571997@gmail.com> wrote: > Update By-->Chandni, > Description-->Key "L" and "M" not work, > Allocate To-->Chandni, > Status-->open. > > "

That was fetch from replay mail

But i want only "i have String "Key "L" work" so how to get particular String.

how to ignore other content and fetch onlt replay mailbody.

fetch mail using pop3

 

You are viewing reply posted by: pandeyism 8 months ago.
Posted 8 months ago

Hi Chand,

Check this example. Now please take its reference and correct your code.

Code

C#

protected void Page_Load(object sender, EventArgs e)
{
    string str = "i have String \"Key \"L\" work On Wed, Apr 11, 2018 at 11:07 AM, <ithelpdesk2571997@gmail.com> wrote: > Update By-->Chandni, > Description-->Key \"L\" and \"M\" not work, > Allocate To-->Chandni, > Status-->open. > > ";
    int index = str.IndexOf(" On");
    string result = str.Substring(0, index);
}

VB.Net

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
    Dim str As String = "i have String ""Key ""L"" work On Wed, Apr 11, 2018 at 11:07 AM, <ithelpdesk2571997@gmail.com> wrote: > Update By-->Chandni, > Description-->Key ""L"" and ""M"" not work, > Allocate To-->Chandni, > Status-->open. > > "
    Dim index As Integer = str.IndexOf(" On")
    Dim result As String = str.Substring(0, index)
End Sub

Screenshot