StringForge 0.1.1

dotnet add package StringForge --version 0.1.1
                    
NuGet\Install-Package StringForge -Version 0.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="StringForge" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="StringForge" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="StringForge" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add StringForge --version 0.1.1
                    
#r "nuget: StringForge, 0.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package StringForge@0.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=StringForge&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=StringForge&version=0.1.1
                    
Install as a Cake Tool

StringForge

StringForge is a compact .NET library with practical string extension methods for everyday text handling.

It focuses on the helpers developers often rewrite from scratch: whitespace normalization, slugs, case conversion, digit extraction, special character cleanup, emoji detection, binary conversion, initials, safe truncation, and simple text searches.

using StringForge;

var slug = "Fun\u00e7\u00f5es em C#: Manipulando Strings com Maestria".ToSlug();
// funcoes-em-c-manipulando-strings-com-maestria

var phone = "+55 (11) 98765-4321".OnlyDigits();
// 5511987654321

var name = "  kalel   alves  ".NormalizeWhitespace().ToTitleCase();
// Kalel Alves

var hasEmoji = "Deploy pronto \U0001F680".HasEmoji();
// true

var binary = 'A'.ToBinary();
// 01000001

Why StringForge?

String manipulation in C# is powerful, but many common workflows still become repetitive across projects. StringForge packages those small, useful operations behind expressive extension methods that are easy to discover, easy to chain, and covered by tests.

Methods

Method Example Result
IsBlank() " ".IsBlank() true
OrEmpty() text.OrEmpty() "" when null
NormalizeWhitespace() "a b\nc".NormalizeWhitespace() "a b c"
RemoveDiacritics() "a\u00e7\u00e3o".RemoveDiacritics() "acao"
OnlyDigits() "(11) 99999-0000".OnlyDigits() "11999990000"
HasEmoji() "Deploy \U0001F680".HasEmoji() true
CountCharacters() "\U0001F680".CountCharacters() 1
HasSpecialCharacters() "abc@123".HasSpecialCharacters() true
RemoveSpecialCharacters() "Hello, world!".RemoveSpecialCharacters() "Hello world"
ToBinary() 'A'.ToBinary() "01000001"
ToBinary() "AB".ToBinary() "01000001 01000010"
Truncate(10) "Manipulating".Truncate(10) "Manipu..."
Left(4) "Kalel".Left(4) "Kale"
Right(3) "Kalel".Right(3) "lel"
EnsureStartsWith("https://") "site.com".EnsureStartsWith("https://") "https://site.com"
EnsureEndsWith("/") "api/v1".EnsureEndsWith("/") "api/v1/"
ReplaceMany(...) "Hi, [name]".ReplaceMany(map) "Hi, Kalel"
ContainsAny(...) "C# and .NET".ContainsAny(["java", ".net"]) true
ContainsAll(...) "C# and .NET".ContainsAll(["c#", ".net"]) true
Between("[", "]") "ID [123]".Between("[", "]") "123"
ToSlug() "Hello, .NET!".ToSlug() "hello-net"
ToSnakeCase() "MyClass".ToSnakeCase() "my_class"
ToKebabCase() "MyClass".ToKebabCase() "my-class"
ToPascalCase() "my class".ToPascalCase() "MyClass"
ToCamelCase() "my class".ToCamelCase() "myClass"
ToTitleCase() "john smith".ToTitleCase() "John Smith"
Initials() "Kalel Alves".Initials() "KA"
CountOccurrences("a") "banana".CountOccurrences("a") 3
IsPalindrome() "A base do teto desaba".IsPalindrome() true
Words() "C# for .NET".Words() ["c", "for", "net"]

Philosophy

  • Keep the API small and memorable.
  • Prefer readable method names over clever abstractions.
  • Return safe values for null or empty text whenever that makes sense.
  • Make common text transformations chainable.
  • Keep behavior documented through focused tests.

Learning References


StringForge em portugues

StringForge e uma biblioteca .NET compacta com metodos de extensao para manipulacao de strings no dia a dia.

A ideia e reunir helpers que desenvolvedores costumam reescrever em varios projetos: normalizacao de espacos, slugs, conversao de case, extracao de digitos, remocao de caracteres especiais, deteccao de emoji, conversao para binario, iniciais, truncamento seguro e buscas simples em texto.

using StringForge;

var slug = "Fun\u00e7\u00f5es em C#: Manipulando Strings com Maestria".ToSlug();
// funcoes-em-c-manipulando-strings-com-maestria

var telefone = "+55 (11) 98765-4321".OnlyDigits();
// 5511987654321

var nome = "  kalel   alves  ".NormalizeWhitespace().ToTitleCase();
// Kalel Alves

var temEmoji = "Deploy pronto \U0001F680".HasEmoji();
// true

var binario = 'A'.ToBinary();
// 01000001

Por que StringForge?

Manipular strings em C# e poderoso, mas muitos fluxos comuns continuam repetitivos. StringForge empacota essas pequenas operacoes em metodos expressivos, faceis de descobrir, faceis de encadear e cobertos por testes.

Metodos

Metodo Exemplo Resultado
IsBlank() " ".IsBlank() true
OrEmpty() text.OrEmpty() "" quando nulo
NormalizeWhitespace() "a b\nc".NormalizeWhitespace() "a b c"
RemoveDiacritics() "a\u00e7\u00e3o".RemoveDiacritics() "acao"
OnlyDigits() "(11) 99999-0000".OnlyDigits() "11999990000"
HasEmoji() "Deploy \U0001F680".HasEmoji() true
CountCharacters() "\U0001F680".CountCharacters() 1
HasSpecialCharacters() "abc@123".HasSpecialCharacters() true
RemoveSpecialCharacters() "Ola, mundo!".RemoveSpecialCharacters() "Ola mundo"
ToBinary() 'A'.ToBinary() "01000001"
ToBinary() "AB".ToBinary() "01000001 01000010"
Truncate(10) "Manipulando".Truncate(10) "Manipu..."
Left(4) "Kalel".Left(4) "Kale"
Right(3) "Kalel".Right(3) "lel"
EnsureStartsWith("https://") "site.com".EnsureStartsWith("https://") "https://site.com"
EnsureEndsWith("/") "api/v1".EnsureEndsWith("/") "api/v1/"
ReplaceMany(...) "Ola, [nome]".ReplaceMany(map) "Ola, Kalel"
ContainsAny(...) "C# e .NET".ContainsAny(["java", ".net"]) true
ContainsAll(...) "C# e .NET".ContainsAll(["c#", ".net"]) true
Between("[", "]") "ID [123]".Between("[", "]") "123"
ToSlug() "Ola, .NET!".ToSlug() "ola-net"
ToSnakeCase() "MinhaClasse".ToSnakeCase() "minha_classe"
ToKebabCase() "MinhaClasse".ToKebabCase() "minha-classe"
ToPascalCase() "minha classe".ToPascalCase() "MinhaClasse"
ToCamelCase() "minha classe".ToCamelCase() "minhaClasse"
ToTitleCase() "joao silva".ToTitleCase() "Joao Silva"
Initials() "Kalel Alves".Initials() "KA"
CountOccurrences("a") "banana".CountOccurrences("a") 3
IsPalindrome() "A base do teto desaba".IsPalindrome() true
Words() "C# para .NET".Words() ["c", "para", "net"]

Filosofia

  • Manter a API pequena e facil de lembrar.
  • Preferir nomes claros em vez de abstracoes inteligentes demais.
  • Retornar valores seguros para textos nulos ou vazios quando isso fizer sentido.
  • Permitir transformacoes comuns em cadeia.
  • Documentar o comportamento com testes focados.

Referencias de estudo

License

MIT

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.1 84 9/3/2026
0.1.0 90 9/3/2026