Albatross.Text 8.1.0-67.main

Prefix Reserved
This is a prerelease version of Albatross.Text.
This package has a SemVer 2.0.0 package version: 8.1.0-67.main+60b90f2.
dotnet add package Albatross.Text --version 8.1.0-67.main
                    
NuGet\Install-Package Albatross.Text -Version 8.1.0-67.main
                    
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="Albatross.Text" Version="8.1.0-67.main" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Albatross.Text" Version="8.1.0-67.main" />
                    
Directory.Packages.props
<PackageReference Include="Albatross.Text" />
                    
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 Albatross.Text --version 8.1.0-67.main
                    
#r "nuget: Albatross.Text, 8.1.0-67.main"
                    
#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 Albatross.Text@8.1.0-67.main
                    
#: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=Albatross.Text&version=8.1.0-67.main&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Albatross.Text&version=8.1.0-67.main&prerelease
                    
Install as a Cake Tool

Albatross.Text

A comprehensive .NET string manipulation library that provides powerful extension methods for working with strings, StringBuilder, and TextWriter classes.

Features

String Interpolation

Advanced string interpolation using ${expression} syntax that allows dynamic value replacement:

using Albatross.Text;

// Simple interpolation with dictionary
var template = "Hello ${name}, you have ${count} messages";
var values = new Dictionary<string, string> 
{
    ["name"] = "John",
    ["count"] = "5"
};

var result = template.Interpolate(key => values[key]);
// Output: "Hello John, you have 5 messages"

String Extensions

Powerful string manipulation methods:

using Albatross.Text;

// Convert to proper case
"hello world".ProperCase(); // "Hello world"

// Convert to camel case  
"HelloWorld".CamelCase(); // "helloWorld"

// Wildcard matching
"test.txt".Like("*.txt"); // true

// Trim custom strings from start/end
"prefixHelloSuffix".TrimStart("prefix"); // "HelloSuffix"
"prefixHelloSuffix".TrimEnd("Suffix"); // "prefixHello"

StringBuilder Extensions

Enhanced StringBuilder functionality:

using Albatross.Text;
using System.Text;

var sb = new StringBuilder("Hello World");
bool endsWithWorld = sb.EndsWith("World"); // true
bool endsWithChar = sb.EndsWith('d'); // true

TextWriter Extensions

Fluent API for writing formatted text:

using Albatross.Text;
using System.IO;

var writer = new StringWriter();
writer.Append("Hello")
      .Space()
      .Append("World")
      .Comma()
      .Tab()
      .AppendLine("Welcome!");
// Output: "Hello World,	Welcome!\n"

// Specialized character methods
writer.OpenParenthesis()
      .Append("content")
      .CloseParenthesis()
      .Dot();
// Output: "(content)."

Prerequisites

  • .NET SDK 6.0 or later
  • Target frameworks supported:
    • .NET Standard 2.1
    • .NET 6.0
    • .NET 8.0
    • .NET 9.0

Installation

Package Manager

Install-Package Albatross.Text

.NET CLI

dotnet add package Albatross.Text

Build from Source

# Clone the repository
git clone https://github.com/RushuiGuan/text.git
cd text

# Restore dependencies
dotnet restore

# Build the project
dotnet build --configuration Release

# Run tests
dotnet test

Usage Examples

Basic String Interpolation

using Albatross.Text;
using System.Collections.Generic;

var template = "User: ${username}, Email: ${email}";
var data = new Dictionary<string, string>
{
    ["username"] = "johndoe",
    ["email"] = "john@example.com"
};

var result = template.Interpolate(key => data.TryGetValue(key, out var value) ? value : "N/A");
Console.WriteLine(result); // "User: johndoe, Email: john@example.com"

Advanced Text Processing

using Albatross.Text;

// Chain multiple string operations
var processed = "  HELLO WORLD  "
    .TrimStart("  ")
    .TrimEnd("  ")
    .CamelCase()
    .PostfixIfNotNullOrEmpty('!');

Console.WriteLine(processed); // "helloWORLD!"

Fluent TextWriter Usage

using Albatross.Text;
using System.IO;

var writer = new StringWriter();
var result = writer
    .OpenSquareBracket()
    .Append("Item1")
    .Comma()
    .Space()
    .Append("Item2")
    .CloseSquareBracket()
    .ToString();

Console.WriteLine(result); // "[Item1, Item2]"

Project Structure

Albatross.Text/
├── StringInterpolationExtensions.cs  # String interpolation functionality
├── StringExtensions.cs               # General string manipulation methods
├── StringBuilderExtensions.cs        # StringBuilder extension methods
├── TextWriterExtensions.cs          # Fluent TextWriter API
└── README.md                        # Project documentation

Running Tests

The project includes comprehensive unit tests to ensure reliability:

# Run all tests
dotnet test

# Run tests with detailed output
dotnet test --verbosity normal

# Run tests for specific framework
dotnet test --framework net8.0

Test files are located in the Albatross.Text.Test project and cover:

  • String interpolation scenarios
  • String extension method functionality
  • StringBuilder extensions
  • TextWriter fluent API
  • Edge cases and error handling

Contributing

We welcome contributions! Please follow these guidelines:

  1. Fork the repository on GitHub
  2. Create a feature branch from main:
    git checkout -b feature/your-feature-name
    
  3. Make your changes with appropriate tests
  4. Ensure all tests pass:
    dotnet test
    
  5. Commit your changes with clear messages:
    git commit -m "Add: Brief description of your changes"
    
  6. Push to your fork and submit a pull request

Code Style

  • Follow existing code conventions
  • Add unit tests for new functionality
  • Update documentation for public APIs
  • Ensure code builds without warnings

Issues

  • Use GitHub Issues to report bugs or request features
  • Provide detailed reproduction steps for bugs
  • Include relevant code samples when possible

License

This project is licensed under the MIT License - see the LICENSE file for details.

Copyright (c) 2019 Rushui Guan

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (10)

Showing the top 5 NuGet packages that depend on Albatross.Text:

Package Downloads
Albatross.CodeGen

A customizable code generator engine with built in support for C# and TypeScript code generation

Albatross.Serialization

Provides additional functionalities for serialization using System.Text.Json.

Albatross.CommandLine

An integration library that simplifies the creation of console program using the System.CommandLine library

Albatross.EFCore.ChangeReporting

Package Description

Albatross.Messaging

A durable messaging library built on top of ZeroMQ

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
8.1.0-67.main 36 9/10/2025
8.1.0-64.main 41 9/3/2025
8.0.11 61 6/27/2025
8.0.10 43 6/26/2025
8.0.8 75 4/25/2025
8.0.7 81 4/15/2025
8.0.6 85 4/9/2025
8.0.4 62 4/8/2025
8.0.1 213 3/4/2025
7.5.8 131 12/25/2024
7.5.7 96 11/11/2024
7.5.6 82 11/8/2024
7.5.5 70 11/7/2024
7.5.4 64 11/7/2024