Str.joinsep
From OpenEUO
Revision as of 22:50, 1 November 2010 by Ximan (Talk | contribs) (Created page with "== Calling Convention == Call local r,c = s.joinsep(sep, a1, a2[, ...]) Args sep is a string a1...aN are of any type (converted to strings internally via tostring()) Results ...")
Calling Convention
Call
local r,c = s.joinsep(sep, a1, a2[, ...])
Args
sep is a string a1...aN are of any type (converted to strings internally via tostring())
Results
r is a string c is a number
Usage Example
local s = sl.str local i = 'Bunch' local r = s.joinsep('|', 'Concatenate', 'A', i, 'Of', 'Strings') print(r)
--> 'Concatenate|A|Bunch|Of|Strings'
Description
Joins all string arguments after the first in order, separated by the sep string provided as the first argument, and returns the resultant string as well as the number of strings joined.
Upon Error
Joinsep fails silently. If joinsep receives only sep as an argument, then a ( '', 0 ) tuple is returned. If joinsep receives only one additional argument, then that value is converted to a string and returned along with the arg count in the result tuple.