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

Last Reply 9 months ago By pandeyism

Posted 9 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

 

Posted 9 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