` Replace function (Maarten) - Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Icetips Article

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

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


Today is April 28, 2024, 8:21 am
This article has been viewed 35142 times.
Google search has resulted in 116 hits on this article since January 25, 2004.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: