Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Plant SCADA

StringReplace()

  • Last UpdatedJul 13, 2023
  • 2 minute read

Replaces or changes specific parts of a provided string and returns the result.

Category

String

Syntax

StringResult = StringReplace( Text, SearchFor, ReplaceWith, CaseSens, NumToReplace, MatchWholeWords );

Parameters

Text

The string in which characters, words, or phrases will be replaced. Actual string or a string equipment.item.

SearchFor

The string to search for and replace. Actual string or a string equipment.item.

ReplaceWith

The replacement string. Actual string or a string equipment.item.

CaseSens

Determines whether the search is case-sensitive. (0=no and 1=yes) Any number or an integer equipment.item.

NumToReplace

Determines the number of occurrences to replace. Any number or an integer equipment.item. To indicate all occurrences, set this value to -1.

MatchWholeWords

Determines whether the function limits its replacement to whole words. (0=no and 1=yes) Any number or an integer equipment.item. If MatchWholeWords is turned on (set to 1) and the SearchFor is set to "and", the "and" in "handle" are not replaced. If the MatchWholeWords is turned off (set to 0), it is replaced.

Remarks

Use this function to replace characters, words, or phrases within a string.

The StringReplace() function does not recognize special characters, such as @ # $ % & * ( ). It reads them as delimiters. For example, if the function StringReplace() (abc#,abc#,1234,0,1,1) is processed, there is no replacement. The # sign is read as a delimiter instead of a character.

Examples

StringReplace("In From Within","In","Out",0,1,0) ' returns "Out From Within" (replaces only the first one);

StringReplace("In From Within","In","Out",0,-1,0) ' returns "Out From without" (replaces all occurrences);

StringReplace("In From Within","In","Out",1,-1,0) ' returns "Out From Within" (replaces all that match case);

StringReplace("In From Within","In","Out",0,-1,1) ' returns "Out From Within" (replaces all that are whole words);

See Also

StringASCII(), StringChar(), StringFromIntg(), StringFromReal(), StringFromTime(), StringInString(), StringLeft(), StringLen(), StringLower(), StringMid(), StringSpace(), StringTest(), StringToIntg(), StringToReal(), StringTrim(), StringUpper(), Text()

String Functions

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in