purescript-strings
purescript-strings copied to clipboard
String utility functions, Char type, regular expressions.
I think the bounds check and the exception are largely unnecessary. Presumably one would be using these APIs if they had already performed the requisite checks. If one wanted an...
* `takeEnd :: Int -> String -> String` * `dropEnd :: Int -> String -> String` Could these functions be added?
`localeCompare` can return different output depending on locale. Example borrowed [from MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare#using_locales): ```js console.log("ä".localeCompare("z", "de")); // a negative value: in German, ä sorts before z console.log("ä".localeCompare("z", "sv")); // a positive...
**Description of the change** Derive `newtype` instances instead of "normal" instances where possible, which produces smaller code. --- **Checklist:** - [x] Added the change to the changelog's "Unreleased" section with...
**Description of the change** Adds a human-friendly `isEmpty` and deprecate `null`. Related: https://github.com/purescript/purescript-arrays/pull/222 --- **Checklist:** - [x] Added the change to the changelog's "Unreleased" section with a reference to this...
**Description of the change** This change adds more examples to the `String.split` function and fixes a typo (occurences → occurrences). --- **Checklist:** - [x] Added the change to the changelog's...
The [unicode character generator](https://github.com/purescript/purescript-strings/blob/master/src/Data/Char/Gen.purs#L10-L11) for unicode characters is picking a random `CodePoint` in the BMP. The [unicode string generator](https://github.com/purescript/purescript-strings/blob/master/src/Data/String/Gen.purs#L16-L19) just generates an arbitrary array of such code points and turns...
Right now the signature of replace on regex is: `foreign import replace :: Regex -> String -> String -> String` and I argue it should be `foreign import replace ::...
Could we provide a function that checks if a string is wellformed w.r.t. its encoding? In the JS backend this would be a check if there are lone surrogates present,...
@michaelficarra is adding functions for working with strings of Unicode code points. Normalization is an important part of supporting Unicode strings, as illustrated by a Spotify blogpost, [Creative Usernames](https://labs.spotify.com/2013/06/18/creative-usernames/). Looks...