unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Christopher Lam <christopher.lck@gmail.com>
To: Vijay Marupudi <vijay@vijaymarupudi.com>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: [PATCH] Add string-split-substring
Date: Sun, 13 Feb 2022 03:28:02 +0000	[thread overview]
Message-ID: <CAKVAZZLF8KKhT4YyakN_FtthugPyeVxXZdppSdV4gvuQBPDDtQ@mail.gmail.com> (raw)
In-Reply-To: <87tud3qxdo.fsf@vijaymarupudi.com>

[-- Attachment #1: Type: text/plain, Size: 966 bytes --]

I think the last test should be:

  (pass-if "string-split-substring - non-empty, trailing delimiters"
    (equal? (string-split-substring "barfoo" "foo")
            (list "bar" ""))))

And isn't it more efficient to use substring/shared instead of substring?

On Sun, 13 Feb 2022 at 03:06, Vijay Marupudi <vijay@vijaymarupudi.com>
wrote:

> Hello all,
>
> I have added a function named `string-split-substring' to the (ice-9
> string-fun) module. It acts like `string-split', but taking a substring
> instead. It works like this
>
> (string-replace-substring "item-1::item-2::item-3::item-4" "::")
> => ("item-1" "item-2" "item-3" "item-4")
>
> The tests include all the edge cases in the tests for string-split, and
> the behavior matches it exactly.
>
> Documentation is also included in the patch.
>
> I have found myself making and using this function numerous times, and
> judging by IRC, others find it useful as well. The patch is attached.
>
> ~ Vijay
>
>

[-- Attachment #2: Type: text/html, Size: 1516 bytes --]

  reply	other threads:[~2022-02-13  3:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-13  3:05 [PATCH] Add string-split-substring Vijay Marupudi
2022-02-13  3:28 ` Christopher Lam [this message]
2022-02-13  4:03   ` Vijay Marupudi

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

  List information: https://www.gnu.org/software/guile/

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

  git send-email \
    --in-reply-to=CAKVAZZLF8KKhT4YyakN_FtthugPyeVxXZdppSdV4gvuQBPDDtQ@mail.gmail.com \
    --to=christopher.lck@gmail.com \
    --cc=guile-devel@gnu.org \
    --cc=vijay@vijaymarupudi.com \
    /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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).