https://github.com/chrberger/stringtoolbox
A simple header-only, single-file string toolbox library for C++.
https://github.com/chrberger/stringtoolbox
cpp11 cpp14 cpp17 header-only platform-independent single-file string strings stringtools
Last synced: 3 months ago
JSON representation
A simple header-only, single-file string toolbox library for C++.
- Host: GitHub
- URL: https://github.com/chrberger/stringtoolbox
- Owner: chrberger
- License: mit
- Created: 2018-02-22T07:03:30.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-15T20:43:26.000Z (over 2 years ago)
- Last Synced: 2025-02-28T12:55:55.980Z (3 months ago)
- Topics: cpp11, cpp14, cpp17, header-only, platform-independent, single-file, string, strings, stringtools
- Language: C++
- Size: 172 KB
- Stars: 15
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
## stringtoolbox - a simple header-only, single-file string toolbox library for C++
[](https://travis-ci.org/chrberger/stringtoolbox) [](https://ci.appveyor.com/project/chrberger/stringtoolbox) [](https://opensource.org/licenses/MIT)
stringtoolbox is a small and efficient library written in modern C++ library to provide some features for processing `std::strings`.
stringtoolbox is available as single-file, header-only library - just drop [stringtoolbox.hpp](https://raw.githubusercontent.com/chrberger/stringtoolbox/master/stringtoolbox.hpp) into your project, `#include "stringtoolbox.hpp"`, and compile your project with a modern C++ compiler (C++11 or newer).
## Table of Contents
* [Features](#features)
* [Dependencies](#dependencies)
* [Contributing](#contributing)
* [License](#license)## Features
* Written in highly portable and high quality C++11
* **Available as header-only, single-file distribution - just drop [stringtoolbox.hpp](https://raw.githubusercontent.com/chrberger/stringtoolbox/master/stringtoolbox.hpp) into your project, `#include "stringtoolbox.hpp"`, and compile your project with a modern C++ compiler (C++11 or newer)**
* Remove leading whitespace characters: `std::string retVal = stringtoolbox::ltrim(" Hello World!");`
* Remove trailing whitespace characters: `std::string retVal = stringtoolbox::rtrim("Hello World! ");`
* Remove leading and trailing whitespace characters: `std::string retVal = stringtoolbox::trim(" Hello World! ");`
* Replace all occurrences of given character: `std::string retVal = stringtoolbox::replaceAll("Hello World.", '.', '!');`
* Split a string using the given delimiter: `std::vector retVal = stringtoolbox::split("Hello,World", ',');`## Dependencies
No dependencies! All you need is a C++11-compliant compiler (we are testing with GCC 4.8.4 and MSVC 19.0.24215.1) as the project ships the following dependencies as part of the source distribution:* [Unit Test Framework Catch2](https://github.com/catchorg/Catch2/releases/tag/v2.1.1) - [](http://www.boost.org/LICENSE_1_0.txt) - [Source](https://github.com/chrberger/stringtoolbox/blob/master/test/catch.hpp)
## Installation
### Installation as single-file, header-only library
stringtoolbox is provided as header-only, single-file library as well - just drop [stringtoolbox.hpp](https://raw.githubusercontent.com/chrberger/stringtoolbox/master/stringtoolbox.hpp) into your project, `#include "stringtoolbox.hpp"`, and compile your project with a modern C++ compiler (C++11 or newer)## Projects using stringtoolbox
If your project is using stringtoolbox, just let us know :-)
* [libcluon](https://github.com/chrberger/libcluon)## Contributing
We are happy to receive your PRs to accelerate libcluon's development; before contributing, please take a look at the [Contribution Documents](CONTRIBUTING.md).## License
* This project is released under the terms of the MIT License - [](https://opensource.org/licenses/MIT)