pike.git / lib / modules / String.pmod / module.pmod

version» Context lines:

pike.git/lib/modules/String.pmod/module.pmod:42:      //! This function implodes a list of words to a readable string, e.g.   //! @expr{({"straw","berry","pie"})@} becomes   //! @expr{"straw, berry and pie"@}. If the separator is omitted, the   //! default is @expr{"and"@}. If the words are numbers they are   //! converted to strings first.   //!   //! @seealso   //! @[`*()]   //! - string implode_nicely(array(string|int|float) foo, string|void separator="and") + string implode_nicely(array(string|int|float) foo, string separator="and")   {    array(string) bar = (array(string))foo;    switch(sizeof(foo))    {    case 0: return "";    case 1: return bar[0];    default: return bar[..<1] * ", " + " " + [string]separator + " " + bar[-1];    }   }