I am working on a program that will automatically get your characters stats and whatnot from the wow armory. I already have the html, and i can identify where the string is, but i need to get the "this.effective" value, which in this case is 594. But since its always changing (and so are the other values, i cant just take it a certain position. Any help would GREATLY appreciated.
Thanks
Matt --------- This is the html snippet:
function strengthObject() {
this.base="168";
this.effective="594";
this.block="29";
this.attack="1168";
this.diff=this.effective - this.base;
You can do it using regular expressions:
using System;
using System.Text.RegularExpressions;
class Program
{
public static void Main()
{
string html = @" function strengthObject() {
this.base=""168"";
this.effective=""594"";
this.block=""29"";
this.attack=""1168"";";
string regex = @"this.effective=""(\d+)""";
Match match = Regex.Match(html, regex);
if (match.Success)
{
int effective = int.Parse(match.Groups[1].Value);
Console.WriteLine("Effective = " + effective);
// etc..
}
else
{
// Handle failure...
}
}
}