The word processor program has a search and replace function. However, partial words (character combinations found in words) are also replaced. To fix this, I plan to remove the extra spaces and use the split function to change the string into an array of words, using "" as a separator.
However, as soon as I look through the array, replace the corresponding words and return the array to a string separated by spaces, the original user formatting will be lost. For example, if the source string was "This sentence". , and the user wanted "a" to be replaced by "the", the output would be "This sentence", without additional spaces.
So my question is, is there a way to search and replace whole words only while maintaining the user’s formatting (extra spaces) in Visual Basic. Thanks.
source share