Login
`
Templates, Tools and Utilities
|
||
Icetips Article
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:37 am This article has been viewed 35231 times.
|
|