This shows you the differences between two versions of the page.
— |
joinstr [2007/02/15 03:53] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | # $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 **N**th word of the return | ||
+ | value is the string catenation of the **N**th word of $//var1//, the | ||
+ | //seperator//, and the **N**th 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. | ||
+ | |||