`
Functions: Replace function 2004-06-04 -- Maarten Newsgroups: comp.lang.clarion > I need a procedure something like this > ReplaceString(BigTextString,FindString,ReplaceString), where it looks for > the FindString and replaces it with ReplaceString in the BigTextString. >SubstTokInMacro(BigTextString,FindString,ReplaceString) !====================================================================== SubstTokInMacro PROCEDURE (STRING pTekst, | STRING pToken, | STRING pReplace) !,String RetVal STRING(65520) Pos LONG Tl SHORT !TokenLenght CODE !(STRING pTekst, STRING pToken, STRING pReplace), String RetVal = pTekst Tl = LEN(CLIP(pToken)) IF RetVal = '' OR Tl = 0 RETURN RetVal END ! Pos = INSTRING(pToken, RetVal, 1, 1) LOOP WHILE Pos RetVal = RetVal[1 : Pos-1] & CLIP(pReplace) & RetVal[Pos+Tl : 65520] Pos = INSTRING(pToken, RetVal, 1, 1) END ! RETURN RetVal !================================================================== -- Best regards, Maarten CDD3.1, C5EEb, C5.5.08EE, C60EE - ABC Certainly Clarion Developer Printed November 23, 2024, 2:11 am This article has been viewed/printed 35454 times. Google search has resulted in 116 hits on this article since January 25, 2004. |