zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh workers <zsh-workers@zsh.org>
Subject: Re: (s) splitting – is there any way to provide «dynamic» separator
Date: Mon, 13 Oct 2014 11:30:15 +0100	[thread overview]
Message-ID: <20141013113015.59c351f5@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <20141010192644.0dfa3ecf@pws-pc.ntlworld.com>

Here's a test.

diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index 49dcea9..d7f39cb 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -1636,3 +1636,23 @@
   print ${noexist:^foo})
 1:Zipping arrays, NO_UNSET part 2
 ?(eval):2: noexist: parameter not set
+
+  expr="a@b,c@d:e@f,g@h:i@j,k@l"
+  for sep in : , @; do
+    print -l ${(ps.$sep.)expr}
+  done
+0:Use of variable to get separator when splitting parameter
+>a@b,c@d
+>e@f,g@h
+>i@j,k@l
+>a@b
+>c@d:e@f
+>g@h:i@j
+>k@l
+>a
+>b,c
+>d:e
+>f,g
+>h:i
+>j,k
+>l

pws


  reply	other threads:[~2014-10-13 10:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-09 15:00 Vasiliy Ivanov
2014-10-09 21:14 ` Peter Stephenson
2014-10-09 21:48   ` Mikael Magnusson
2014-10-10 18:26     ` Peter Stephenson
2014-10-13 10:30       ` Peter Stephenson [this message]
2014-10-10  1:45 ` (s) splitting - is there any way to provid e "dynamic" separator Bart Schaefer
2014-10-10  7:06   ` (s) splitting - is there any way to provide " Vasiliy Ivanov
2014-10-11  0:38     ` Han Pingtian
2014-10-11  3:31       ` Bart Schaefer
2014-10-11 11:52         ` Han Pingtian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141013113015.59c351f5@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).