namespace for misc string utility More...
#include "CxxUtils/StringUtils.h"
#include "StringUtils_aux.h"
#include <algorithm>
#include <iostream>
Namespaces | |
namespace | CxxUtils |
Copy the elements of a sequence for which a predicate is true. | |
Functions | |
size_t | CxxUtils::StringUtils::getStringWidth (const std::string &str) |
calculate the width of a string | |
void | CxxUtils::StringUtils::writeFixedWidth (std::ostream &os, const std::string &input, size_t width, const std::string &align) |
writes a string to a given stream with a fixed width | |
size_type | CxxUtils::StringUtils::findParenthesisMatch (const std::string &str, size_type nextpos, const std::string &paropen, const std::string &parclose) |
finds the nearest matching parenthesis in a string from a given position | |
size_type | CxxUtils::StringUtils::rfindParenthesisMatch (const std::string &str, size_type nextpos, const std::string &paropen, const std::string &parclose) |
reverse-finds the nearest matching parenthesis in a string from a given position | |
size_type | CxxUtils::StringUtils::findFree (const std::string &haystack, const std::string &needle, const std::string &paropen, const std::string &parclose, size_type startpos) |
finds the next "free" occurrence of needle in haystack | |
size_type | CxxUtils::StringUtils::rfindFree (const std::string &haystack, const std::string &needle, const std::string &paropen, const std::string &parclose, size_type startpos) |
reverse-finds the next "free" occurrence of needle in haystack | |
size_type | CxxUtils::StringUtils::findFreeOf (const std::string &haystack, const std::string &needles, const std::string &paropen, const std::string &parclose, size_type startpos) |
finds the next "free" occurrence of any needle in haystack | |
size_type | CxxUtils::StringUtils::rfindFreeOf (const std::string &haystack, const std::string &needles, const std::string &paropen, const std::string &parclose, size_type startpos) |
reverse-finds the next "free" occurrence of any needle in haystack | |
std::string | CxxUtils::StringUtils::replaceSymbols (const std::string &str, StringUtils::FORMAT inputFormat, StringUtils::FORMAT outputFormat) |
replaces unicode, latex and html symbols with one another as desired | |
std::string | CxxUtils::StringUtils::replaceSpecialScript (const std::string &str, StringUtils::SPECIALSCRIPT inputType, StringUtils::SPECIALSCRIPT outputType) |
replaces unicode superscript and subscript with the corresponding ascii characters and vice-versa | |
size_type | CxxUtils::StringUtils::findBeginSpecialScript (const std::string &str, StringUtils::SPECIALSCRIPT scripttype, size_type pos) |
finds the next entity of a certain type of special script | |
size_type | CxxUtils::StringUtils::findEndSpecialScript (const std::string &str, StringUtils::SPECIALSCRIPT scripttype, size_type pos) |
finds the next entity not belonging to a certain type of special script | |
std::string | CxxUtils::StringUtils::stripUnprintableCharacters (const std::string &str, bool allowNonAscii) |
removes all non-printable characters from a string | |
StringUtils::FORMAT | CxxUtils::StringUtils::guessFormat (const std::string &input) |
guesses the format of a string | |
size_t | CxxUtils::StringUtils::readLaTeXToken (const std::string &latex, std::string &token, size_t start) |
reads the next LaTeX token | |
std::string | CxxUtils::StringUtils::convertText (const std::string &input, StringUtils::FORMAT inputFormat, StringUtils::FORMAT outputFormat) |
converts a string from one format into another | |
std::string | CxxUtils::StringUtils::convertText (const std::string &input, StringUtils::FORMAT outputFormat) |
converts a string into any format |
namespace for misc string utility
Also implemented are functions that allow easy conversion between HTML-type strings, LaTeX-type strings, unicode strings and plain ascii strings. The aim of these methods is converting symbols and mathematical expressions in strings, including subscript and superscript and special mathematical or greek symbols - they are not intended as a replacement for conversion of entire documents and do not respect text or background colors, sectioning commands, annotations, document meta-information, non-textual elements, custom macro definitions, javascript, or any other features beyond basic text markup.