stringbuilder 0.1.0

A mutable string builder class, similar to .NET's StringBuilder, that provides provides efficient methods for building and modifying strings.


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

StringBuilder

A @safe mutable string builder class for the D programming language, modeled after .NET's System.Text.StringBuilder. It provides efficient methods for appending, inserting, removing, and replacing strings, with support for numeric types, wide strings, interpolated expressions, and more.

The purpose of this project is to experiment with various text handling issues that will be encountered during the Phobos 3 development process.

Features

  • All major .NET StringBuilder API methods and properties
  • Fluent interface (methods return StringBuilder)
  • Comprehensive unit tests
  • UTF-8, UTF-16, UTF-32 support
  • Interpolated string support

Usage Examples

Basic Append

import phobos.text.stringbuilder;

auto sb = new StringBuilder();
sb.append("Hello");
sb.append(" ");
sb.append("World");
assert(sb.toString() == "Hello World");

Insert and Remove

sb.clear();
sb.append("Hello World");
sb.insert(5, "Beautiful ");
assert(sb.toString() == "Hello Beautiful World");
sb.remove(5, 9);
assert(sb.toString() == "Hello World");

Replace

sb.replace("World", "Dlang");
assert(sb.toString() == "Hello Dlang");
sb.replace("Dlang", "D", 6, 5);
assert(sb.toString()
Authors:
  • Adam Wilson
Dependencies:
none
Versions:
0.1.0 2026-Feb-09
~master 2026-Feb-09
Show all 2 versions
Download Stats:
  • 0 downloads today

  • 1 downloads this week

  • 1 downloads this month

  • 4 downloads total

Score:
0.0
Short URL:
stringbuilder.dub.pm