|
-
Mar 26th, 2019, 01:03 PM
#5
Re: Search file for string and append file to it
 Originally Posted by Mightymax
&CH1; is the entity placeholder and Bld1_Ch1.sgm is the file with the contents I want to copy in the master.
You could use a regex search to find all the matches for the entity placeholders in the master file.
You can use the same regex search to capture the entity digits, and use those digits to build the name of the file that corresponds to the entity place holder (i.e. &CH1; uses file Bld1_Ch1.sgm, and &CH63; uses file Bld1_Ch63.sgm, and so on).
Then create a StringBuilder from the contents of the master file.Loop through the regex matches that were found and use the StringBuilder's Replace method to replace each of the regex matches (i.e. the &CH###; entities) with the contents of the corresponding Bld1_Ch###.sgm file.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|