webCOMAND

string_util::append_string()

Append a separator and second string to the end of an existing first string, if the second string is not empty.  Otherwise, leave the first string unchanged.

Prototype

string append_string(string &$string, string $separator, string $append_string)

Parameters

  • string - Text string variable to appending separator and append_string to, if append_string is not an empty string.
  • separator - Text string to first append to string if append_string is not an empty string.
  • append_string - Text string to append to string after separator if it is not an empty string.

Return

A string containing the string passed in first parameter, followed by optional separator if that string is not empty, followed by the append_string.

Example

\io_comand_util\string_util::append_string($csv, ',', $value);