Version

UltraCalcFunctionReplace Class

Replaces a substring of a text value with some new text. This substring is specified by giving it's starting point and it's length in characters, within the original text value.
Syntax
'Declaration
 
Public Class UltraCalcFunctionReplace 
   Inherits BuiltInFunctionBase
public class UltraCalcFunctionReplace : BuiltInFunctionBase 
Remarks

REPLACE(text_value, starting_point, character_count, new_text_value)

Text_value is the original text within which you want to replace some substring of text, and you already know the starting_point and character_count of that substring.

Starting_point is the one-based position within text_value where the replaced substring begins.

Character_count is the length of the substring being replaced as a count of the characters it contains. If this value when added to starting_point would exceed the length remaining in text_value then the entire remainder of text_value is replaced.

New_text_value is some new text that replaces the text of the specified substring. It is not required to be the same length as the replaced substring.

When starting_point or character_count are error values, or less than zero, an error value is returned. If starting_point exceeds the length of text_value then an error value is returned.

It is possible to use the REPLACE() function with other UltraCalc functions to express the replacement of one substring with another. The following UltraCalc expression replaces the word "Old" with the word "New" in the original text value.

REPLACE("Hello Old World", FIND("Old"), LEN("Old"), "New")
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also