Site Tools


joinstr

# $EPIC: joinstr.txt,v 1.2 2007/02/15 03:53:35 jnelson Exp $

Synopsis:

$joinstr(seperator var1 var2)

Description:

This function joins two word lists together with a seperator. Formally: This function returns a word list wherein the Nth word of the return value is the string catenation of the Nth word of $var1, the seperator, and the Nth word of $var2. Please note that var1 and var2 must be variable names, not the values themselves.

You can join together more than two variables in this way: just list the variable names.

If one variable has less words than another variable, then the empty value is used to hold the place of any missing words.

Practical:

If you had two variables, one containing nicks and the other containing user@hosts, you might use a function like copattern to turn user@host wildcards into nicknames. But if you wanted to create nick!user@hosts, you could use this function:

@nicks = [one two three]
@userhosts = [foo@baz.com boo@ya.com bar@oof.com]
@nuh = joinstr(! nicks userhosts)
echo $nuh

would output

one!foo@baz.com two!boo@ya.com three!bar@oof.com

History:

The joinstr function first appeared in EPIC4-1.1.8. The ability to join more than two variables first appeared in EPIC4-1.1.15.

joinstr.txt · Last modified: 2007/02/15 03:53 by 127.0.0.1