Orxonox: src/util/StringUtils.cc File Reference

# StringUtils.cc File Reference

Implementation of several string manipulation functions. More...

`#include "StringUtils.h"`
`#include <cctype>`
`#include "Convert.h"`
`#include "Math.h"`

## Namespaces

namespace | orxonox

## Functions

std::string | orxonox::addSlashes (const std::string &str)
| Adds backslashes to the given string which makes special chars visible. Existing slashes will be doubled.
std::string | orxonox::BLANKSTRING ("")
std::string | orxonox::getComment (const std::string &str)
| If the string contains a comment, the comment gets returned (including the comment symbol), an empty string otherwise.
size_t | orxonox::getCommentPosition (const std::string &str)
| If the string contains a comment, the position of the comment-symbol gets returned, std::string::npos otherwise.
std::string | orxonox::getLowercase (const std::string &str)
| Returns a copy of the given string without uppercase chars.
size_t | orxonox::getNextCommentPosition (const std::string &str, size_t start)
| Returns the position of the next comment-symbol, starting with start.
size_t | orxonox::getNextQuote (const std::string &str, size_t start)
| Returns the position of the next quote in the string, starting with start.
std::string | orxonox::getStringBetweenQuotes (const std::string &str)
| If the string contains something like '..."between quotes"...' then 'between quotes' gets returned (without quotes).
std::string | orxonox::getStripped (const std::string &str)
| Returns a copy of a string without whitespaces.
std::string | orxonox::getUniqueNumberString ()
std::string | orxonox::getUppercase (const std::string &str)
| Returns a copy of the given string without lowercase chars.
bool | orxonox::hasComment (const std::string &str)
| Returns true if the string contains a comment, introduced by #, %, ; or //.
bool | orxonox::hasStringBetweenQuotes (const std::string &str)
| Returns true if the string contains something like '..."between quotes"...'.
bool | orxonox::isBetweenQuotes (const std::string &str, size_t pos)
| Returns true if pos is between two quotes.
bool | orxonox::isComment (const std::string &str)
| Determines if a string is a comment (starts with a comment-symbol).
bool | orxonox::isEmpty (const std::string &str)
| Determines if a string is empty (contains only whitespaces).
bool | orxonox::isNumeric (const std::string &str)
| Determines if a string contains only numbers and maximal one '.'.
void | orxonox::lowercase (std::string *str)
| Replaces each char between A and Z with its lowercase equivalent.
int | orxonox::nocaseCmp (const std::string &s1, const std::string &s2, size_t len)
| Compares the first 'len' chars of two strings ignoring different casing.
int | orxonox::nocaseCmp (const std::string &s1, const std::string &s2)
| Compares two strings ignoring different casing.
std::string | orxonox::removeSlashes (const std::string &str)
| Removes backslashes from the given string. Double backslashes are interpreted as one backslash.
std::string | orxonox::removeTrailingWhitespaces (const std::string &str)
| Returns a copy of a string without trailing whitespaces.
void | orxonox::strip (std::string *str)
| Removes all whitespaces from a string.
std::string | orxonox::stripEnclosingBraces (const std::string &str)
| Removes enclosing {braces} (braces must be exactly on the beginning and the end of the string).
std::string | orxonox::stripEnclosingQuotes (const std::string &str)
| Removes enclosing quotes if available (including whitespaces at the outside of the quotes).
void | orxonox::uppercase (std::string *str)
| Replaces each char between a and z with its uppercase equivalent.

## Detailed Description

Implementation of several string manipulation functions.