stringbuffer 1.1.2

A stack based string buffer that grows into the heap if needed.


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:

StringBuffer

alt text

A simple stack based StringBuffer that overflows into the heap and releases all used memory on destruction.

By default the StringBuffer can store 512 chars on the stack. If a different number of chars on the stack is required create an

alias MyStringBuffer = StringBufferImpl!1337;

like this.

The two important methods of the StringBuffer are writer and getData. The method writer returns a OutputRange that can be used with formattedWrite from std.format; The method getData returns a string of the stored data. No reference to the returned data from writer and getData must be used after the associated StringBuffer is destructed.

Example

unittest {
	import std.format : formattedWrite;

	StringBuffer buf;
	auto w = buf.writer();
	formattedWrite(w, "foobar %d", 10);
	assert(buf.getData() == "foobar 10");
}
Authors:
  • burner
Dependencies:
none
Versions:
1.1.2 2017-May-19
1.1.1 2017-May-16
1.1.0 2017-May-16
1.0.0 2017-Feb-23
~master 2017-May-19
Show all 5 versions
Download Stats:
  • 4 downloads today

  • 23 downloads this week

  • 153 downloads this month

  • 21906 downloads total

Score:
2.6
Short URL:
stringbuffer.dub.pm