Login
`
Templates, Tools and Utilities
|
||
Add a comment to an Icetips ArticlePlease add your comments to this article.
Please note that you must provide both a name and a valid email address in order
for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!
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 November 21, 2024, 6:35 am This article has been viewed 35450 times. Google search has resulted in 116 hits on this article since January 25, 2004.
|
|