aboutsummaryrefslogtreecommitdiff
path: root/lib/20-strings
blob: f04f68d1e04079d46f9370c23a4128845f4cba8b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh

join(){
  # Join strings by a given delimiter.
  # $1 = delimiter
  # $2..$N = strings
  _bcj_delim=$1; shift
  _bcj_result=''
  while [ $# -gt 0 ]; do
    _bcj_result="${_bcj_result:+${_bcj_result}${_bcj_delim}}${1}"
    shift
  done
  printf '%s' "$_bcj_result"
}