About MString

Current version

Back to

The project


MString wraps the C string functions in one convenient class. It has no dependencies from other facilities than a standard C++ environment and thus should be completely platform independent.

The code had been checked for memory leaks on Linux with Valgrinds memcheck tool, and for code coverage of the unit tests with gcov.
Recent MString releases have been tested in the following environments:

If you got MString running successfully in other environments please drop me a line, so I can add them to this list.
The package includes an unit test in main.cpp which you can use to verify proper functionality of all methods. Some of the tests rely on a German locale, so you may have to adapt some of the test strings before it runs flawlessly.

MString is published as open source software under the terms of the GPL.


I was looking for a stand-alone, lightweight string class to use in a project and couldn't find anything that doesn't come bundled with some heavy toolkit. Except for the STL string class, whose interface I don't like.

Your advantages when using MString:

What MString can't do:



1.1.1 July 31, 2007

So I finally found the time and brains to introduce some improvements that were floating round my head for some time now :-) There's a new class MUnittest that does what its name says - helping with unit tests, so I was able to clean up the mess in main.cpp. Then there's no need to think about the maximal length of time format strings anymore. The line wrap method now recognizes Unix, Mac and Windows style linebreaks, independent of the current platform. The conversion of time strings to time_t values is able to tell the difference between AM and PM. Conversion of unsigned int and unsigned long values to strings can show plus signs and align it on demand. And some more; see ChangeLog.


1.1.0 December 26, 2006

This release introduces some interface changes; all for the better of the class, I think. I got rid of several size parameters that so far had to be provided manually and thus were limiting comfort. And while on it some checks for special cases had been added. Altogether a whole stack of improvements, thus the leap in the minor version number.


1.0.1 August 22, 2006

Many improvements, some new methods. Among others, there's the possibility to convert strings to time_t values now. MString has been tried and tested in production code over the past months, and there's nothing that stands against using it :-)


1.0.0 May 26, 2006

This is the promised major step, introducing major changes in naming which make MString (I hope) more comprehensible and verbose. At the same time there had been no larger functional changes, so this version can be considered stable (now concerning the interface, too, I think).


0.6.1 March 26, 2006

Improved some odds and ends; see ChangeLog for all details. The foreach() macro got a little fix and will not be defined if there's already a definition (this improves interoperability with Boost and Qt, as they provide their own, more versatile and convenient foreach()). A DLLEXPORT define was introduced to make exporting from shared libs easy. slice() had been renamed to operator(); you can now obtain a slice by writing stringobject(start, end). vali() and valui() can be given a base, so you can convert e. g. hex strings to integers.
I'm now thinking about renaming some namespace members (mstring to MString, mstring_list to MStringList) and methods to more verbose, "OO-like" identifiers and finally release MString 1.0.


0.6.0 February 20, 2006

This version introduces mstring_list, a STL list based container for MString objects, and a complementary, simple foreach() macro which can be used for all STL containers.


0.5.1 September 12, 2005

Here's another release, providing the possibility to convert timestamp values (time_h) to strings. I also got rid of some more temporary char arrays to decrease memory usage, and made a handful of minor improvements. See ChangeLog for details.


0.5.0 August 20, 2005

This release includes some improvements that were inspired by a discussion on, mainly facilities to exclude unused parts in order to make the class more lightweight in binaries and memory. These parts are included by default for most convenience and have to be explicitely disabled through the provided defines. Thanks to Kevin Krammer for the clues.
Furthermore I was able to increase performance and decrease memory usage; the unit test runs faster by about one third now on my box. Altogether a release that I think is worth increasing the minor number.


0.4.2 July 22, 2005

This is the first public release of the MString class. Its previous versions up to 0.4.1 had been used successfully in production code for some time now and can by and large be considered as stable.