Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

String.Split - How to calculate slot

smoothcodesmoothcode Posts: 1Member
Hello,

look im new in programming, would be awesome if u could help me.

Im reading a whole .csv File with this:


[code]private void button3_Click(object sender, EventArgs e)
{
{
var content = string.Empty;
using (StreamReader reader = new StreamReader(@"C:/1.csv", System.Text.Encoding.Default))
{
content = reader.ReadToEnd();
reader.Close();
}

content = content.Replace(""", string.Empty);
content = content.Replace(" ", "");
content = content.Replace(" ", "");

using (StreamWriter writer = new StreamWriter(@"C:/2.csv"))
{
writer.Write(content);
writer.Close();
}
}
}[/code]


1.CSV Input looks like this:


" 09000";"Catalaog 1";10148;234
" 09001";"Catalaog 2";0;345

2.CSV Outlooks like this:


09000~Catalaog 1~10148~234
09001~Catalaog 2~0~0


I need a rewrite of my Code that the last delimited Columns 10148~234 get calculated.

String must look like this at the end:

09000~Catalaog 1~9914~234
09001~Catalaog 2~0~0

See the diffrence? The 10148 - 234 = 9914. The 10148 gets replaced with the result.

Could u rewrite my upper code and help me ?:<
Sign In or Register to comment.