Skip to main content
insightsoftware Documentation insightsoftware Documentation
{%article.title%}
Published:
Was this article helpful?
0 out of 0 found this helpful

StrReplace

Use this function to replace a part of a character string with a different character string.

You may find the StrReplace function useful for comparison purposes. For example, suppose a complete symbol in your system appears in the format A11234.

You can use the StrReplace function to change all prefix codes from A to B.

Copy

Syntax

STRREPLACE (SymName|"String","SearchString","NewString")         

where:

  • SymName is the name of a symbol.
  • "String" is a character string enclosed in double quotation marks.
  • SearchString is an existing character string, enclosed in double quotation marks. This parameter is case-sensitive and must be typed with the correct combination of uppercase and lowercase letters.
  • NewString is a new character string, enclosed in double quotation marks. This parameter is case-sensitive and must be typed with the correct combination of uppercase and lowercase letters.
Copy

Syntax

STRREPLACE (CodeLetB,"A","B")            
Copy

Example

CREATE VARIABLE StrTemp1 AS STRING
Variable = STRREPLACE ("SourceString","SearchFor","ReplaceWith")
SET VARIABLE StrTemp1 = STRREPLACE ("StringTest","Test","xxxx")
StrTemp1 will equal "Stringxxxx" (without the double quotation marks)        

Published:

StrReplace

Use this function to replace a part of a character string with a different character string.

You may find the StrReplace function useful for comparison purposes. For example, suppose a complete symbol in your system appears in the format A11234.

You can use the StrReplace function to change all prefix codes from A to B.

Copy

Syntax

STRREPLACE (SymName|"String","SearchString","NewString")         

where:

  • SymName is the name of a symbol.
  • "String" is a character string enclosed in double quotation marks.
  • SearchString is an existing character string, enclosed in double quotation marks. This parameter is case-sensitive and must be typed with the correct combination of uppercase and lowercase letters.
  • NewString is a new character string, enclosed in double quotation marks. This parameter is case-sensitive and must be typed with the correct combination of uppercase and lowercase letters.
Copy

Syntax

STRREPLACE (CodeLetB,"A","B")            
Copy

Example

CREATE VARIABLE StrTemp1 AS STRING
Variable = STRREPLACE ("SourceString","SearchFor","ReplaceWith")
SET VARIABLE StrTemp1 = STRREPLACE ("StringTest","Test","xxxx")
StrTemp1 will equal "Stringxxxx" (without the double quotation marks)        

For an optimal Community experience, Please view on Desktop