Stringly 0.1.0
See the version list below for details.
dotnet add package Stringly --version 0.1.0
NuGet\Install-Package Stringly -Version 0.1.0
<PackageReference Include="Stringly" Version="0.1.0" />
<PackageVersion Include="Stringly" Version="0.1.0" />
<PackageReference Include="Stringly" />
paket add Stringly --version 0.1.0
#r "nuget: Stringly, 0.1.0"
#:package Stringly@0.1.0
#addin nuget:?package=Stringly&version=0.1.0
#tool nuget:?package=Stringly&version=0.1.0
Stringly
The most over-engineered way to build a string. On purpose.
using static Stringly.Say;
Console.WriteLine(One().Three().Three().Seven()); // 1337
Console.WriteLine(H().e().l().l().o()); // Hello
Console.WriteLine(Four().Two()); // 42, the answer to everything
"strongly typed" is good engineering. "stringly typed" — shoving everything into
strings — is the opposite. Stringly commits to it completely: a fluent API where you
spell strings out one token at a time.
How it reads
Each token is a method that appends one character and returns a Phrase, so it keeps chaining:
using static Stringly.Say;
string motd = H().i().Bang(); // "Hi!"
string pi = "3" + Period() + "14159".One().Four(); // operator math: "3.1415914"... (see below)
What you can do
| Feature | Example | Result |
|---|---|---|
| Digits & letters | One().Two().Three() / H().e().y() |
"123" / "Hey" |
| Symbols | At().Hash().Star() |
"@#*" |
| Splice a word | Say.Text("copy").Question() |
"copy?" |
| Repeat last token | S().o().Repeat(5) |
"Soooooo" |
| Case math | H().i().ToUpperInvariant() |
"HI" |
Backspace (<<) |
One().Two().Three() << 1 |
"12" |
| Concatenation | Four().Two() + " " + ("o".O().k()) |
"42 ok" |
The extension contract (this is the real point)
The vocabulary is meant to grow from other packages. The whole contract is:
Write an extension method on
Phrase, call the publicAdd, return aPhrase.
namespace Stringly.Nato;
public static class NatoExtensions
{
public static Phrase Alpha(this Phrase p) => p.Add('A');
public static Phrase Bravo(this Phrase p) => p.Add('B');
// macros compose existing tokens for free:
public static Phrase TenFour(this Phrase p) => p.Add("10-4");
}
Consumers reference Stringly + your pack and everything chains in one expression. With
C# 14 extension members a pack can even contribute its own chain-starting entry points.
Notes
Phraseis immutable: every call returns a new phrase, nothing is rendered untilToString(). That makes+and<<safe and keeps intermediate strings from piling up.using static Stringly.Say;is what unlocks the bareOne()entry calls.- Requires .NET 10 / C# 14.
MIT.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Stringly:
| Package | Downloads |
|---|---|
|
Stringly.Morse
Morse code pack for Stringly: build dits and dahs by hand, or convert an accumulated phrase with ToMorse() — "SOS".ToMorse() spells "... --- ...". |
|
|
Stringly.Nato
NATO phonetic alphabet pack for Stringly: Alpha().Bravo().Charlie() and radio macros like TenFour(). An example of how to extend Stringly from a separate package. |
|
|
Stringly.Greek
Greek alphabet pack for Stringly: Alpha().Beta().Gamma() spells "αβγ" in real Unicode glyphs. Demonstrates that Stringly tokens are not limited to ASCII. |
|
|
Stringly.Emoji
Emoji pack for Stringly: Fire().Rocket().Hundred() spells "🔥🚀💯". Multi-codepoint tokens, proving Stringly chains aren't limited to single chars. |
GitHub repositories
This package is not used by any popular GitHub repositories.