strcombine#

Purpose#

Converts an NxM string array to an Nx1 string vector by combining each element in a column separated by a user-defined delimiter string.

Format#

y = strcombine(sa, delim, qchar)#
Parameters:
  • sa (NxM string array) – data

  • delim (1x1 or 1xM or Mx1) – delimiter string.

  • qchar (scalar or vector) –

    scalar, 2x1, or 1x2 string vector containing quote characters as required:

    scalar:

    Use this character as quote character.

    If this is 0, no quotes are added.

    2x1 or 1x2 string vector:

    Contains left and right quote characters.

Returns:

y (Nx1 string vector) – result.

Examples#

Basic example#

// Create 1x3 string array
sa_dir = "C:" $~ "gauss" $~ "myProject";

// Combine 1x3 string array with '/' at end of each element
path = strcombine(sa_dir, "/", 0);

After the above code, path is equal to:

"C:/gauss/myProject/"

Remarks#

Note that strcombine() adds a delimiter after the final element. To combine strings with the delimiter added only between tokens, see strjoin().

Source#

strfns.src

See also

Functions satostrC(), strjoin()