Giter VIP home page Giter VIP logo

Comments (5)

jasonm23 avatar jasonm23 commented on July 17, 2024
(let* ((str "this is a test")
       (sep " ")
       (s-car (car (s-split sep str)))
       (s-cdr (substring str (length (concat s-car sep)))))
  (cons s-car s-cdr))

Something like this...

from s.el.

jasonm23 avatar jasonm23 commented on July 17, 2024
(defun s-split-cons (s &optional separator)
  "Split S using SEPARATOR (defaults to space).

The return value is a `cons' cell with the first item of the
split as `car' and the rest of the string as `cdr'.

For example.

   (s-split-cons \"this:that\" \":\")
   => (\"this\" . \"that\")

   (s-split \"more than one\")
   => (\"more\" . \"than one\")
"
  (declare (side-effect-free t))
  (let* ((sep (or separator " "))
         (s-car (car (s-split separator s)))
         (s-cdr (substring s (+ 1 (length (concat s-car separator))))))
   (cons s-car s-cdr)))

So I'll consider the utility of this one. It seems very niche tbh.

@Atlas48 Can you help me understand how this would be generally useful to many people. I struggled as I wrote the docstring to think of a use-case for this.

from s.el.

jasonm23 avatar jasonm23 commented on July 17, 2024

@magnars any thoughts on this?

from s.el.

magnars avatar magnars commented on July 17, 2024

I'm of the opinion that we should keep the s api generally useful. There are a lot of features that could conceivably fit under the "string manipulation" umbrella. I'm wary of adding all of them to the bulk of code that we're maintaining.

In this specific case, I think I agree with you @jasonm23 that this seems quite niche.

from s.el.

jasonm23 avatar jasonm23 commented on July 17, 2024

I'm closing this as out of scope.

from s.el.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.