vchapran
April 27th, 2001, 01:31 PM
I'm building a string for a message box, combining the return values from many functions, which validate the statuses of controls, allowed values for some variables and so on. Actually, everything was done before me, and the validation is pretty complicated. Sometimes the final string contains duplicates, i.e. the same substring presented in the final string several times. For example "You are required manager approval to send this order. Highlighted Fields require data. Highlighted Fields require data. The Quantity exceedes permitted value. Highlighted Fields require data".
I know how I can avoid inserting an additional substring (it's not acceptable since it requires rewriting many functions), if it exists already in a string, but I'd like to delete duplicates from the final string. It seems to be more safe and simpler. I have an idea to loop through the string with InStr function, changing Start parameter after it finds a substring and then use Replace function if it finds second occurance of the substring. But maybe there is more simple way?
Any idea would be greatly appreciated.
Thank you.
Vlad
I know how I can avoid inserting an additional substring (it's not acceptable since it requires rewriting many functions), if it exists already in a string, but I'd like to delete duplicates from the final string. It seems to be more safe and simpler. I have an idea to loop through the string with InStr function, changing Start parameter after it finds a substring and then use Replace function if it finds second occurance of the substring. But maybe there is more simple way?
Any idea would be greatly appreciated.
Thank you.
Vlad