Scripting Guide > Types of Data > Work with Character Functions > Substitute and Substitute Into Functions
发布日期: 09/18/2023

Substitute and Substitute Into Functions

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 = .;

需要更多信息?有问题?从 JMP 用户社区得到解答 (community.jmp.com).