I have a string in C# that's essentially a CSS file. I can parse this CSS file and extract values with this library that has been extremely helpful: https://github.com/TylerBrinks/ExCSS
That's all fantastic. However, I now need to change the values within the file and I cannot figure out for the life of me how to reliably do this.
In the simplest terms possible, I have this string in C#:
body
{
background-color:#323432;
}
I need to write a function:
public string ChangeValue(string oldstring, string name, string type, string value)
That when called with this:
string newstring = ChangeValue("body{background-color:#323432;}", "body","background-color","#ffffff");
The "newstring" string above, turns into this:
body
{
background-color:#ffffff;
}
Really really appreciate the help. Thank you.
public string ChangeValueor are you stuck with avoidreturn type?