MattHiggs Posted April 29, 2016 Share Posted April 29, 2016 (edited) I would like to know the best way to replace text located on a user-selected line of a text file. The text doesn't necessarily have to be the whole line of the txt file. I guess I am also asking about the general behavior of the functions when opened with "append" or "overwrite": If i set the position to a particular line in the text file and then use "Filewrite", if I opened the file with overwrite, will it overwrite the text rather than insert itself at the current position and preserving the text? I am under the impression that calling filewrite would just insert the data at position and not overwrite (except maybe with the exception or fileWriteline? Does that overwrite the line of text which contains current position?). Am I wrong? The only way I can think of to do this would be to read the file to an array, access the particular portion of the array with the data I want to edit, edit the string, then write the array to the file again using the overwrite flag. Am I overthinking this? Edited April 30, 2016 by MattHiggs Link to comment Share on other sites More sharing options...
mikell Posted April 29, 2016 Share Posted April 29, 2016 _FileWriteToLine() Link to comment Share on other sites More sharing options...
MattHiggs Posted April 30, 2016 Author Share Posted April 30, 2016 17 hours ago, mikell said: _FileWriteToLine() Perfect, Didn't think to look in udfs. These sleepless nights getting to me... Link to comment Share on other sites More sharing options...
iamtheky Posted April 30, 2016 Share Posted April 30, 2016 and if you can provide some real examples, I bet a dollar some stringregexp solutions would appear. ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now