yamid

yamid

  • NA
  • 98
  • 0

Replace a string in text file with a 2D array

Aug 26 2016 10:19 PM
Dear friends,
I have 2D array of doubles in C# and also I have a text file including many texts.
Somewhere in the text file I have a text called"[$CHANGE]". I would like to replace ["$CHANGE"] with the content of the 2D array with the same number of columns and rows.
How can I do this in a short way?
 
For example.
 
1. My original text file C:/MyText.txt:
HELLO TO EVERY ONE
[$CHANGE"] 
NOW GOODBYE 
 
2. My Array:
1 2 3
1.1 2.1 3.1
5.1 5.2 5.3
 
3. My text file after replacing the array:
HELLO TO EVERY ONE
1 2 3
1.1 2.1 3.1
5.1 5.2 5.3
NOW GOODBYE
 
 

Answers (1)