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 Par2: String replacement function 2007-09-28 -- Peter Hermansen STRPOS!
I've written a class with a few text manipulating methods. Here's the one
you need. You can turn it into a function if you don't want to do the class
thing.
EDFuncClass.ReplaceAll Procedure(STRING pOldStr, STRING pNewStr, STRING
pText)
! Replaces all occurencies of pOldStr in pText with pNewStr
X LONG,Auto
Code
loop
X = STRPOS(pText,pOldStr,True)
if X
pText = pText[1 : X-1] & Clip(pNewStr) & pText[X + LEN(Clip(pOldStr))
: LEN(Clip(pText))]
else
BREAK
end
end
RETURN(pText)
Today is November 21, 2024, 7:25 am This article has been viewed 35230 times.
|
|