https://github.com/goswinr/str
String module and extensions for F#
https://github.com/goswinr/str
fable fsharp string string-manipulation
Last synced: 11 months ago
JSON representation
String module and extensions for F#
- Host: GitHub
- URL: https://github.com/goswinr/str
- Owner: goswinr
- License: mit
- Created: 2024-02-25T15:29:56.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-06-16T06:49:15.000Z (about 1 year ago)
- Last Synced: 2025-06-16T07:45:20.317Z (about 1 year ago)
- Topics: fable, fsharp, string, string-manipulation
- Language: F#
- Homepage: https://goswinr.github.io/Str/
- Size: 360 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README

# Str
[](https://www.nuget.org/packages/Str/)
[](https://github.com/goswinr/Str/actions/workflows/build.yml)
[](https://github.com/goswinr/Str/actions/workflows/docs.yml)
[](https://github.com/goswinr/Str/actions/workflows/test.yml)
[](https://github.com/goswinr/Str/actions/workflows/outdatedDotnetTool.yml)
[](LICENSE.md)

Str is an F# extension and module library for `System.String`
It compiles to Javascript and Typescript with [Fable](https://fable.io/).
### It Includes:
- A `Str` module that has all methods from the String type as functions, and more. Adapted and extended from [FSharpX](https://github.com/fsprojects/FSharpx.Extras/blob/master/src/FSharpx.Extras/String.fs)
- A Computational Expressions `str` that can be used build up strings ( using a StringBuilder internally).
- Extension members on `Str` like `.Get` `.First` `.Last` `.SecondLast` and more.
With nicer IndexOutOfRangeExceptions that include the bad index and the actual size.
- Extensive Tests running on both .NET and JS
### Usage
Just open the module
```fsharp
open Str
```
this module contains:
- a static class also called `Str`
- a Computational Expressions called `str`
- this will also auto open the extension members on `System.String`
then you can do:
```fsharp
let hello = // "Hello, World !!!"
str {
"Hello"
','
" World "
for i in 1..3 do
"!"
}
```
### Full API Documentation
[goswinr.github.io/Str](https://goswinr.github.io/Str/reference/str.html)
### Tests
All Tests run in both javascript and dotnet.
Successful Fable compilation to typescript is verified too.
Go to the tests folder:
```bash
cd Tests
```
For testing with .NET using Expecto:
```bash
dotnet run
```
for JS testing with Fable.Mocha and TS verification:
```bash
npm test
```
### License
[MIT](https://github.com/goswinr/Str/blob/main/LICENSE.md)
### Changelog
see [CHANGELOG.md](https://github.com/goswinr/Str/blob/main/CHANGELOG.md)