Solved

Extract number from html tag

Posted on 2013-02-06
2
406 Views
Last Modified: 2013-02-06
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
Comment
Question by:zattz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 42

Accepted Solution

by:
sedgwick earned 500 total points
ID: 38859236
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
 

Author Closing Comment

by:zattz
ID: 38859775
thx
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

631 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question