Once in a while I run into a situation that really surprises me. Being on a job to install and configure a world leading scan and imaging application I was surprised about the built-in scripting tool available. The built-in scripting language is a rather old fashioned Basic derivate known under the name Softbridge Basic Language (SBL). I had no choice. I needed to do some scripting in the Validation process of this product and no other tools available. SBL indeed was the delighted way to go. Not that I’m afraid of a little old fashioned coding. I have had my share of Assembler and Cobol coding in the past. One of the simple things I hade to do is some character replacement in strings. A Replace statement please? Not. Definitely not. So once again I had to write one of my own. If you ever happen to collide with this world leading scan and imaging application then I have at least some code for you. Here it is: function replacestring (source as string, _ search as string, repl as string) as string ' ' One VB6 Replace replacement ' dim index as integer ' index in source dim position as integer ' instr position in source dim result as string ' build result here ' index = 1 result = "" do position = instr (index, source, search) if position > 0 then result = result & mid$ (source, index, position - index) & repl index = position + len (search) else result = result & mid$ (source, index) end if loop while position > 0 ' replacestring = result end function
Aad Slingerland Zevenaar The Netherlands