For the latest version of JMP Help, visit JMP.com/help.


Scripting Guide > Types of Data > Concat > Substitute and Substitute Into
Publication date: 04/28/2021

Substitute and Substitute Into

The Substitute() function returns a copy of a string with a replacement expression. The Substitute Into() function changes the original string with a replacement expression.

For example, consider the following script:

str1 = str2 = "All things considered";
 

// str3 holds the result of the Substitute, and str1 is not changed

str3 = Substitute( str1, "All", "Some" );
 

/* Substitute Into returns nothing, so str4 is missing,

and str2 is changed and now holds the result of Substitute Into */

str4 = Substitute Into( str2, "All", "Some" );
Show( str1, str2, str3, str4 );

This script returns the following output:

str1 = "All things considered";

str2 = "Some things considered";

str3 = "Some things considered";

str4 = .;

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).