following code replaces Figure 1....so on with <a href=1>1</a> .....so on
but want to replace this " <a href=1>1</a> " ....... with <a href="#fig1">Figure 1</a>....so on
in single line declaration
please help me
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
FileInfo n = new FileInfo(textBox1.Text);
StringBuilder newFile = new StringBuilder();
string temp = " ";
string[] file = File.ReadAllLines(textBox1.Text);
foreach (string line in file)
{
if (line.Contains("Figure 1"))
{
temp = line.Replace("Figure 1", "<a href=1>1</a>");
newFile.Append(temp + "\r\n");
continue;
}
if (line.Contains("Figure 2"))
{
temp = line.Replace("Figure 2", "<a href=2>2</a>");
newFile.Append(temp + "\r\n");
continue;
}
newFile.Append(line + "\r\n");
}
File.WriteAllText(@"D:\madhu\test\1.xhtml", newFile.ToString());
}
}