Scripting Guide > Types of Data > Work with Character Functions
Publication date: 07/08/2024

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"
Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).