Skip to main content
23-Emerald V
June 9, 2012
Question

Concatenating strings and scalars / arrays

  • June 9, 2012
  • 3 replies
  • 14062 views

The attached worksheet arose out of a need to generate a sequence of alphanumeric strings. There are 3 functions, Str, Concat and concatenate.

Str takes a single argument, which can be a string, scalar or (possibly nested) array, range definition or range variable, and converts all of its elements into a string or string array.

Concat takes a pair of inputs, which can be strings, scalars or (possibly nested) arrays, converts all elements into strings and concatenates them.

concatenate takes a single argument, a list (vector) of strings, scalars or vectors, converts all elements into strings and concatenates them.

In both cases, the arrays must be conformable (ie, have the same shape).

Note the conversion of the range variable in Concat, however!

Stuart

dev - Str Concat concatenate 01-a.jpg

dev - Str Concat concatenate 01-b.jpg

dev - Str Concat concatenate 01-c.jpg

dev - Str Concat concatenate 01-d.jpg

3 replies

1-Visitor
June 9, 2012

Good work Stuart. Great explanation as usual.

Mike

24-Ruby III
June 10, 2012

Thanks, Stuart.

19-Tanzanite
June 10, 2012

I think this is a good example of where it would be very useful to have a variable number of arguments in a user defined function. Yet another thing that has been on the wish list for a long time

23-Emerald V
June 11, 2012

Thank you, Mike, Vladimir and Richard. I hope the optional / arbitrary argument list finds its way off a wish list and onto Prime's development list.

Stuart

1-Visitor
June 12, 2012

I hope the optional / arbitrary argument list finds its way off a wish list and onto Prime's development list.

Stuart

Be sure to keep bring the point up then

I have regularly pushed my ideas and PTC have listened in the past and believe they are again with some features being implemented in Prime 3.0.

Mike