libosmscout 0.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules
String.cpp File Reference
#include <osmscout/util/String.h>
#include <algorithm>
#include <cctype>
#include <cstring>
#include <cwchar>
#include <iomanip>
#include <locale>
#include <sstream>
#include <array>
#include <ctime>
#include <thread>
#include <osmscout/system/Math.h>
#include <osmscout/log/Logger.h>
#include <osmscout/util/Locale.h>
#include <osmscout/util/ObjectPool.h>
#include <osmscout/util/utf8helper.h>
#include <osmscout/private/Config.h>

Namespaces

namespace  osmscout
 Original source: https://github.com/philipperemy/easy-encryption/blob/master/b64.h licensed under terms of MIT license.
 

Functions

const char * osmscout::BoolToString (bool value)
 Returns a string representation of the given boolean value (either 'true' or 'false')
 
std::string osmscout::ByteSizeToString (double size, const Locale &locale=Locale::ByEnvironmentSafe())
 
std::string osmscout::ByteSizeToString (FileOffset size, const Locale &locale=Locale::ByEnvironmentSafe())
 Prints byte size with short, human readable form by ISO/IEC 80000 standard.
 
size_t osmscout::CountWords (const std::string &text)
 
std::string osmscout::DurationString (const Duration &duration)
 
std::string osmscout::FloatToString (double value, const Locale &locale, uint32_t precision=3)
 Returns locale-aware string representation of number.
 
bool osmscout::GetDigitValue (char digit, size_t &result)
 Returns the numerical value of the given character, if the character is a digit in a numerical value.
 
std::string osmscout::GetFirstInStringList (const std::string &stringList, const std::string &divider)
 Assumes that the string consists of a number of values separated by one of the given divider.
 
std::string osmscout::GetTokensFromEnd (const std::list< std::string > &tokens, size_t count)
 
std::string osmscout::GetTokensFromStart (const std::list< std::string > &tokens, size_t count)
 
int osmscout::GetUtcOffset ()
 returns the utc timezone offset (e.g.
 
void osmscout::GroupStringListToStrings (std::list< std::string >::const_iterator token, size_t listSize, size_t parts, std::list< std::list< std::string > > &lists)
 Given a list of strings, individual strings will be combined into a given number of sub groups (individual string concatenated and separated by a space).
 
std::string osmscout::LocaleStringToUTF8String (const std::string &text)
 Convert the given std::string in the current locale to a std::string containing a corresponding UTF8 character sequence.
 
std::wstring osmscout::LocaleStringToWString (const std::string &text)
 Converts the given std::string with content in the current locale to a std::wstring.
 
time_t osmscout::MkTimeUTC (struct tm *timeptr)
 https://stackoverflow.com/a/9088549/1632737
 
std::string osmscout::NumberToString (long value, const Locale &locale)
 Returns locale-aware string representation of number.
 
bool osmscout::ParseISO8601TimeString (const std::string &timeStr, Timestamp &timestamp)
 Parse time string in ISO 8601 format "2017-11-26T13:46:12.124Z" (UTC timezone) to Timestamp (std::chrono::time_point with millisecond accuracy).
 
std::string osmscout::ReplaceString (const std::string &in, const std::string &search, const std::string &replacement)
 Replace all occurrences of search in input string by some other string.
 
void osmscout::SimplifyTokenList (std::list< std::string > &tokens)
 Simplifying a token list by merging tokens that start with an upper case letter followed by a token starting with a lower case letter.
 
std::list< std::string > osmscout::SplitString (const std::string &stringList, const std::string &separator, int maxSize=-1)
 Split string by separator.
 
std::list< std::string > osmscout::SplitStringAtSpace (const std::string &input)
 Converts the given string into a list of whitespace separated (std::isspace()) strings.
 
std::optional< std::pair< std::string, std::string > > osmscout::SplitStringToPair (const std::string &str, const std::string &separator)
 Split string by separator to two parts.
 
bool osmscout::StringToBool (const char *string, bool &value)
 Convert the given string to a boolean value.
 
bool osmscout::StringToNumber (const char *string, double &value)
 
bool osmscout::StringToNumber (const std::string &string, double &value)
 
std::string osmscout::TimestampToISO8601TimeString (const Timestamp &timestamp)
 Format Timestamp to string in ISO8601 format "2017-11-26T13:46:12.124Z" for UTC timezone.
 
void osmscout::TokenizeString (const std::string &input, std::list< std::string > &tokens)
 Converts the given string into a list of whitespace or colon-separated strings.
 
std::string osmscout::Trim (const std::string &str, char trimmedChar=' ')
 Trim trimmedChar from begin and end of str.
 
std::string osmscout::UTF8NormForLookup (const std::string &text)
 Normalise the given std::string containing a UTF8 character sequence for tolerant comparison.
 
std::string osmscout::UTF8StringToLocaleString (const std::string &text)
 Convert the given std::string in UTF-8 a std::string containing to corresponding string in the current locale.
 
std::string osmscout::UTF8StringToLower (const std::string &text)
 Convert the given std::string containing a UTF8 character sequence to lower case using the translation table implementation.
 
std::u32string osmscout::UTF8StringToU32String (const std::string &text)
 Convert the given std::string containign a UTF8 character sequence to a std::u32string.
 
std::string osmscout::UTF8StringToUpper (const std::string &text)
 Convert the given std::string containing a UTF8 character sequence to upper case using translation table implementation.
 
std::wstring osmscout::UTF8StringToWString (const std::string &text)
 Convert the given std::string containign a UTF8 character sequence to a std::wstring.
 
std::string osmscout::UTF8Transliterate (const std::string &text)
 Transliterate non-ascii characters to one or more characters that are similar to the original character.
 
std::string osmscout::WStringToLocaleString (const std::wstring &text)
 Converts the given std::wstring to a std::string with content in the current locale.
 
std::string osmscout::WStringToUTF8String (const std::wstring &text)
 Convert the given std::wstring to a std::string containing a corresponding UTF8 character sequence.