Skip to content
This repository has been archived by the owner on Jul 5, 2022. It is now read-only.

Commit

Permalink
Try to implement explode and implode because fish-shell/fish-shell#159.
Browse files Browse the repository at this point in the history
Still not sure how to explode strings without sed.
  • Loading branch information
ShadowKyogre committed Sep 29, 2014
1 parent e8f5e08 commit b2ea87f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .config/fish/functions/explode.fish
@@ -0,0 +1,5 @@
function explode
if test (count $argv) -eq 2
echo $argv[1]|sed 's|'$argv[2]'|\n|g'
end
end
13 changes: 13 additions & 0 deletions .config/fish/functions/implode.fish
@@ -0,0 +1,13 @@
function implode
if test (count $argv) -ge 2
set finished ""
for arg in $argv[1..-2]
if test $arg = $argv[-2]
break
end
set finished (printf "%s%s%s" $finished $arg $argv[-1])
end
set finished (printf "%s%s" $finished $argv[-2])
echo $finished
end
end

0 comments on commit b2ea87f

Please sign in to comment.