Comments (15)
Maybe s.el (the long lost Emacs string manipulation library) can be used as inspiration?
from carp.
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.
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.
Great, yes this looks like a very decent start indeed.
from carp.
Looks good! It also reminds me that we still have to wrap a regex library!
from carp.
- string to int
- int to string
from carp.
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.
Should have looked at the source
from carp.
I feel like this is OK to close now?
from carp.
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.
OK, let us leave it open until then, then :)
from carp.
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.
Sorry for the noise, lots of rebasing to get things to line up nicely.
from carp.
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.
@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)
- memory management crash
- performance: better default string functions
- Bug with REPL displaying result of calling function that returns Char HOT 1
- REPL prompt is not `鯉` on Linux HOT 2
- (()) seems to cause an infinite loop on the latest release
- Packaging issues. HOT 1
- `format` leaks memory HOT 1
- `--eval-preload` does not have access to Core anymore HOT 6
- [Bug] Not handling all cases during pattern-matching in lambdas HOT 8
- [Bug] Control.iterate-until double-uses a variable, and thus is broken HOT 3
- [Feat Request] Exhaustive pattern-matching for `defn` HOT 5
- [Bug] Issue pattern matching structs HOT 7
- Document println*
- Feature Request: Make running tests not dependent on stack?
- CarpHask fails to build with hashable >= 1.4 (GHC 9.2 / Stackage LTS-20) HOT 4
- FR: Better Support for Embedded HOT 5
- Get Can't find symbol 'make-update-deriver' when trying to run example on Windows 11 HOT 7
- [bug] duplicate bindings in environment HOT 2
- Repl crashes on type of Map
- Repl :t command doesn't work with (use) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from carp.