Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 416
  • Last Modified:

Extract number from html tag

Hi

I have the following html:

<span class='LocalTime' gmt_time='1360039849'></span>

Open in new window


How can I extract just the number, "1360039849" from this tag using c#?

Thanks
0
zattz
Asked:
zattz
1 Solution
 
Meir RivkinFull stack Software EngineerCommented:
if you have the html as text then u can do:

 string anchor = "gmt_time='";
            int startIndex = html.IndexOf(anchor) + anchor.Length;
            int endIndex = html.IndexOf('\'', startIndex);
            string gmt_time = html.Substring(startIndex, endIndex - startIndex );

Open in new window

0
 
zattzAuthor Commented:
thx
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now