#195678 - 2009-08-2906:38 PMRe: Replace function in 4.61 RC1 gives incorrect results.
[Re: Allen]
Glenn BarnasGlenn Barnas KiX Supporter
Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Right, missed that. I fixed the example in my post. I just copied/pasted Ruud's example at first.
I agree - Replace() without the offset just simplifies Join/Split. I can only think of a few times where I didn't need to make a global replacement.
Honestly, what would make the most sense to me is
Replace(Source, Substring1, Substring2, Offset, Count) which would search Source for Substring1, replacing it with Substring2, but only from the Offset position (or N'th occurrence) and only process Count replacements. Without a Count parameter, Offset doesn't seem to have as much value.
Here's a UDF with sample code that illustrates my thoughts using "N'th Occurrence" and "Count" optional parameters:
Just my opinion..
Glenn
_________________________ Actually I am a Rocket Scientist!