here is a new version with 6 methods,
which each use "Join", the method
GeekDude provided - and with my extension
and "Join2", the original method from the docu:
Code: Select all
out .= "1a --> " ", ".join(["a", "b", "fish"]) "`n"
out .= "1b --> " ", ".join2(["a", "b", "fish"]) "`n"
out .= "2a --> " ", ".join("a", "c", "fish") "`n"
out .= "2b --> " ", ".join2("a", "c", "fish") "`n"
array := ["a", "e", "fish"]
out .= "3a --> " ", ".join(array) "`n"
out .= "3b --> " ", ".join2(array) "`n"
out .= "4a --> " ", ".join(array*) "`n"
out .= "4b --> " ", ".join2(array*) "`n"
out .= "5a --> " join(",", array) "`n"
out .= "5b --> " join2(",", array) "`n"
out .= "6a --> " join(",", array*) "`n"
out .= "6b --> " join2(",", array*) "`n"
msgbox, % out
Join(s,p*){
static _:="".base.Join:=Func("Join")
for k,v in p
{
if isobject(v)
for k2, v2 in v
o.=s v2
else
o.=s v
}
return SubStr(o,StrLen(s)+1)
}
Join2(s,p*){
for k,v in p
o.=s v
return SubStr(o,StrLen(s)+1)
}
It shows that all function calls (1a ... 6a) are possible with "Join" and that only one function call (6b) is possible with "Join2" and needs "
array*"
Hubert