Approach User Support homepage Approach User Support
Answers to Frequently Asked Questions about Lotus Approach
Examples LotusScripts
Example databases
Links to other Lotus Approach support services

[Return to contents]

Example LotusScript: Another "Translate" function in LotusScript

Last updated: 12 Jul 2002

"Steven Levine" <> contributed his version of a "translate" function in LotusScript:

Function swapchars(target As String, this As String, forthis As String) As
' replaces every occurance of 'this' in 'target' by 'forthis'
' swapchas is considered to be a local variable within the subroutine
 Dim at As Integer, limit As Integer, forthislen As Integer
 swapchars = target
 at = 1
 limit = Len(target)*2
 forthislen = Len(forthis)
   at = Instr(at,swapchars,this)
   If at = 0 Then Exit Do
   swapchars = Left$(swapchars,at-1) & forthis & Mid$(swapchars,at+1)
   at = at + forthislen
   limit = limit-1
 Loop Until (limit = 0)
End Function

[Return to contents]

© Copyright, JohnBrown, Trademarks, Disclaimer, Acknowledgements.