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

Work with Character Functions

This section shows how to use some of the more complex character functions that are described in Character Functions in the JSL Syntax Reference.

Concat Function

In the Concat function, expressions yielding names are treated like character strings, but globals that have the name values are evaluated. The following example demonstrates that if you have a stored name value, you need to either use Char before storing it in a global, or Name Expr on the global name.

n = {abc};
c = n[1] || "def";
Show( c );

"abcdef"

 
m = Expr( mno );
c = m || "xyz";
Show( c );

Name Unresolved: mno in access or evaluation of 'mno' , mno/*###*/

// The /*###*/ characters indicate the location of an error in the script execution.

 
m = Expr( mno );
c = Name Expr( m ) || "xyz";
Show( c );

"mnoxyz"

 
m = Char( Expr( mno ) );
c = m || "xyz";
Show( c );

"mnoxyz"

Concat Items() converts a list of string expressions into a single string, with each item separated by a delimiter. If unspecified, the delimiter is a blank. Its syntax is

resultString = Concat Items ({list of strings}, <“delimiter string”>);

For example,

a = {"ABC", "DEF", "HIJ"};
result = Concat Items(a, "/");

returns

"ABC/DEF/HIJ"

Alternatively,

result = Concat Items( a );

returns

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