StringForge 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package StringForge --version 0.1.0
                    
NuGet\Install-Package StringForge -Version 0.1.0
                    
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.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="StringForge" Version="0.1.0" />
                    
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.0
                    
#r "nuget: StringForge, 0.1.0"
                    
#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.0
                    
#: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.0
                    
Install as a Cake Addin
#tool nuget:?package=StringForge&version=0.1.0
                    
Install as a Cake Tool

StringForge

Uma biblioteca .NET pequena, direta e pronta para o dia a dia de quem precisa manipular textos sem reescrever os mesmos helpers em todo projeto.

using StringForge;

var slug = "Funções 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 🚀".HasEmoji();
// true

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

Por que existe?

Manipular strings em C# costuma envolver as mesmas operacoes basicas: concatenar, substituir, buscar, dividir, formatar, validar prefixos/sufixos e normalizar textos. A proposta do StringForge e empacotar esses casos em metodos expressivos, testados e faceis de descobrir.

Instalacao

Enquanto o pacote nao estiver publicado no NuGet, use referencia direta ao projeto:

dotnet add reference ../StringForge/StringForge.csproj

Quando publicar:

dotnet add package StringForge

Metodos

Metodo Exemplo Resultado
IsBlank() " ".IsBlank() true
OrEmpty() text.OrEmpty() "" quando nulo
NormalizeWhitespace() "a b\nc".NormalizeWhitespace() "a b c"
RemoveDiacritics() "ação".RemoveDiacritics() "acao"
OnlyDigits() "(11) 99999-0000".OnlyDigits() "11999990000"
HasEmoji() "Deploy pronto 🚀".HasEmoji() true
CountCharacters() "🚀".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"]

Referencias de estudo

Desenvolvimento

dotnet restore
dotnet build
dotnet test

Publicacao no NuGet

Este repositorio usa GitHub Actions com NuGet Trusted Publishing, sem chave de API fixa.

Antes da primeira publicacao, configure no NuGet.org:

  • Acesse sua conta no NuGet.org.
  • Abra Trusted Publishing.
  • Adicione uma policy de GitHub Actions.
  • Repository owner: kalelalves.
  • Repository: StringForge.
  • Workflow file: publish.yml.
  • Environment: deixe vazio.
  • Crie no GitHub uma repository variable chamada NUGET_USER com seu username do NuGet.org.

Para publicar manualmente, abra o workflow Publish NuGet package no GitHub Actions e informe a versao.

Para publicar por tag:

git tag v0.1.0
git push origin v0.1.0

Licenca

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