How to replace characters of this textfile?
Posted on 2005-04-13
I have textfiles, each filled with 400 characters > this looks something like this > AHFTGDHDGFHFGDHDGDGFH but then ofcourse up to 400. This results in 400 positions.
Now I want to replace some characters by means of their position because when this textfile is read into my stringgrid, some words must be formed. Now I have the positions of the characters to be replaced > for example > the characters at position 75 to 79 should be replaced with some other characters.
Suppose the textfile reads ABCDEFGHIJKLMNOPQRSTUVWXYZ.. and the positions to be replaced were 5,6,7, and 8 > the new characters would be PAUL then I want to be able to just have to define the positions and the new characters and after a button click the file should read: ABCDPAULIJKLMNOPQRSTUVWXYZ..
I also would like to be able to generate a 400 character textfile with random characters in it. If you need more info please let me know.