Giter VIP home page Giter VIP logo

Comments (15)

Kungsgeten avatar Kungsgeten commented on May 15, 2024 2

Maybe s.el (the long lost Emacs string manipulation library) can be used as inspiration?

from carp.

hellerve avatar hellerve commented on May 15, 2024 1

Don’t worry! We have to document the standard modules sooner or later, to make it a bit easier for people to know what’s there.

from carp.

hellerve avatar hellerve commented on May 15, 2024

I have a list of useful functions (this is a verbatim copy of what’s present in zepto):

  • (String.join strs delim): joins a list of strings with a delimiter
  • (String.split str delim): splits a string on a delimiter, returns a list of substrings
  • (String.in? str sub): checks whether a substring is within a string
  • (String.count str c): counts the number of occurrences of character c in a string
  • (String.starts-with? str sub): checks whether a string starts with a substring
  • (String.ends-with? str sub): checks whether a string ends with a substring
  • (String.trim str): trims whitespace from a string
  • (String.upper? str): checks whether string is upper case
  • (String.lower? str): checks whether string is lower case
  • (String.num? str): checks whether string is numerical
  • (String.alpha? str): checks whether string is alphabetical
  • (String.alphanum? str): checks whether string is alphanumerical

There are more useful functions, but that’s a whole lot and a good start, I’d say.

Cheers

from carp.

eriksvedang avatar eriksvedang commented on May 15, 2024

Great, yes this looks like a very decent start indeed.

from carp.

hellerve avatar hellerve commented on May 15, 2024

Looks good! It also reminds me that we still have to wrap a regex library!

from carp.

bjorn3 avatar bjorn3 commented on May 15, 2024
  • string to int
  • int to string

from carp.

hellerve avatar hellerve commented on May 15, 2024

Those are already provided as Int.str and Int.from-string! The floating point data types do not have from-string functions, but should probably have them...

from carp.

bjorn3 avatar bjorn3 commented on May 15, 2024

Should have looked at the source

from carp.

eriksvedang avatar eriksvedang commented on May 15, 2024

I feel like this is OK to close now?

from carp.

hellerve avatar hellerve commented on May 15, 2024

I haven’t ported everything from the long lost Emacs string library yet, nor do I intend to. SOme of the functions do not need to b included in the standard library, in my opinion.

That being said, I do think that a handful of functions from the library should be included, like truncate and split-up-to.

from carp.

eriksvedang avatar eriksvedang commented on May 15, 2024

OK, let us leave it open until then, then :)

from carp.

chrisosaurus avatar chrisosaurus commented on May 15, 2024

I am going to do a little work on the Strings module, adding documentation, and adding some new functions which I think are important.

I will send a PR once I have a few commits ready.

from carp.

chrisosaurus avatar chrisosaurus commented on May 15, 2024

Sorry for the noise, lots of rebasing to get things to line up nicely.

from carp.

eriksvedang avatar eriksvedang commented on May 15, 2024

I guess the String module will never be completely done, so perhaps we can close this now? Or are there still some functions that we really need? If so – let's enumerate them so we know what to shoot for.

from carp.

chrisosaurus avatar chrisosaurus commented on May 15, 2024

@eriksvedang good point, I'm pretty happy with the current shape of String for now, I don't see anything huge missing, happy for this to be closed.

from carp.

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.