ReplaceText

jdubs edited this page Oct 21, 2016 · 1 revision

Table of Contents

Overview

Locates and replaces text in variable supplied.

Parameters

SpecName (constant) The variable containing the text to search.

OldCharacter (multiple) The value containing the character to find and replace.

NewCharacter (multiple | optional) The value containing the character for replacement. If value is empty the text will simply be removed.

ErrorMessage (multiple | optional) The error message to return when any error occurs.

Synopsis

This method searches the variable for the supplied text, and upon discovery replaces with the supplied new value. For example, a NewCharacter of "6" and an old character of "4" applied to the value "747" would result in "767".

Source Code

public static void ReplaceText(string SpecName, object OldCharacter, object NewCharacter, object ErrorMessage)
{
	Break();
	try
	{
		Variable(SpecName).Value = Variable(SpecName).Value.Replace((string)OldCharacter, (string)NewCharacter);
	}
	catch (Exception ex)
	{
		throw new Four51ActionsException(ex.Message, (string)ErrorMessage);
	}
}

Referenced Methods

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.