1
Answer

Replace a string in text file with a 2D array

yamid

yamid

8y
191
1
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)