NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
stringtools.cpp File Reference
#include "stringtools.hpp"
#include "../settings.hpp"
#include "../structures.hpp"
#include "fast_float/fast_float.h"
#include <cstring>
#include <sstream>
#include <iomanip>
Include dependency graph for stringtools.cpp:

Go to the source code of this file.

Functions

std::string getNextArgument (std::string &sArgList, bool bCut)
 
double intPower (double, int)
 This function calculates the power of a value with the specialization that the exponent is an integer. More...
 
std::string toString (int nNumber, const Settings &_option)
 Converts an integer to a string. More...
 
std::string toString (double dNumber, const Settings &_option)
 Converts a double to a string using the precision from the Settings object. More...
 
std::string toString (double dNumber, int nPrecision)
 Converts a double to a string using the passed precision. More...
 
std::string toString (const std::complex< double > &dNumber, int nPrecision)
 Converts a complex number into a printable string. More...
 
std::string toString (int nNumber)
 Converts an integer to a string without the Settings bloat. More...
 
std::string toString (size_t nNumber)
 Converts an unsigned integer to a string. More...
 
std::string toString (__time64_t tTime, int timeStampFlags)
 Converts a time_t to a string. Will actually print a timestamp. More...
 
std::string toString (sys_time_point tp, int timeStampFlags)
 Converts a sys_time_point to a string. More...
 
std::string toString (long long int nNumber)
 Converts a long long int to a string. More...
 
std::string toString (bool bBoolean)
 Converts a boolean to a string by actually converting the numerical value to "true" and "false". More...
 
std::string toCmdString (double dNumber)
 Converts a numerical value into a "full" precision string. More...
 
std::string toCmdString (const std::complex< double > &dNumber)
 Converts a numerical value into a "full" precision string. More...
 
std::string toHexString (int nNumber)
 Converts an integer to a hexadecimal number printed as string. More...
 
std::vector< std::string > toStrVector (std::string sString)
 This function converts a std::string into a std::vector, where the string shall be passed as "{x,y,z,...}". More...
 
std::vector< int > toIntVector (std::string sString)
 This function converts a std::string into a std::vector, where the string shall be passed as "{x,y,z,...}". More...
 
std::string condenseText (const std::string &sText)
 Removes vowels and umlauts from the passed string. More...
 
std::string truncString (const std::string &sText, size_t nMaxChars)
 This function truncates the string to the passed max length (including a trailing ellipsis) or returns it unmodified, if it is shorter. More...
 
void StripSpaces (std::string &sToStrip)
 Removes leading and trailing white spaces and tabulator characters. More...
 
int StrToInt (const std::string &sString)
 Converts a string into an integer. More...
 
double StrToDb (const std::string &sString)
 Converts a string into a double. More...
 
double StrToLogical (const std::string &sString)
 Converts a string into a double considering logical values. More...
 
std::complex< double > StrToCmplx (const std::string &sString)
 Converts a string into a complex number. More...
 
sys_time_point StrToTime (const std::string &sString)
 Convert a string to a sys_time_point. More...
 
size_t versionToInt (std::string sVersion)
 Converts a version string into a multi-digit integer. More...
 
std::string intToVersion (size_t nVersionDigits)
 Converts a multi-digit integer into a verison string. More...
 
std::string toInternalString (std::string sStr)
 Converts a string literal to the internal representation in tables and clusters. More...
 
std::string toExternalString (std::string sStr)
 Converts an internal string to the external representation in the terminal. More...
 
std::string toLowerCase (const std::string &sUpperCase)
 Converts uppercase to lowercase letters. More...
 
std::string toUpperCase (const std::string &sLowerCase)
 Converts lowercase letters to uppercase ones. More...
 
static bool isDateTimePattern (const std::string &sStr, size_t pos)
 Static function to determine, whether the character at passed position fits the pattern needed for a date. More...
 
bool isConvertible (const std::string &sStr, ConvertibleType type)
 This function checks, whether a string can be converted to the selected ConvertibleType. More...
 
static int isDatePattern_US (const std::string &sStr, size_t i)
 Returns a formatting flag combination, if the string is a US-specific date pattern or TD_NONE. More...
 
static int isDatePattern_DE (const std::string &sStr, size_t i)
 Returns a formatting flag combination, if the string is a DE-specific date pattern or TD_NONE. More...
 
static int isTimePattern (const std::string &sStr, size_t i)
 Returns a formatting flag combination, if the string is a time pattern or TD_NONE. More...
 
int detectTimeDateFormat (const std::string &sStr)
 Detects the contained date-time format and returns it as a bitflag composition. More...
 
std::string wcstombs (const std::wstring &wStr)
 This function is a wrapper for the usual wcstombs function, which can handle wstrings. More...
 
std::string toSystemCodePage (std::string sOutput)
 Converts an internal to an external string. Does nothing currently. More...
 
std::string fromSystemCodePage (std::string sOutput)
 Transforms the system code page to the internal one. More...
 
std::string utf8parser (const std::string &sString)
 Transforms a UTF8 encoded string into a standard ASCII string in the internal code page representation. More...
 
std::string getTimeStamp (bool bGetStamp)
 This function simple returns the current time as a default timestamp. More...
 
std::vector< std::string > split (const std::string &sStr, char cSplit)
 Splits a vector at the selected characters. More...
 
std::string ellipsize (const std::string &sLongString, size_t nMaxStringLength)
 Shortens the passed string by introducing a ellipsis in the middle of the string, if the string is longer than the maximal string length. More...
 
void replaceAll (std::string &sToModify, const char *sToRep, const char *sNewValue, size_t nStart, size_t nEnd)
 This function replaces all occurences of the string sToRep in the string sToModify with the new value sNewValue. The boundaries limit the range of processing. More...
 
void replaceAll (std::string &sToModify, const std::string &sToRep, const std::string &sNewValue, size_t nStart, size_t nEnd)
 This function replaces all occurences of the string sToRep in the string sToModify with the new value sNewValue. The boundaries limit the range of processing. This function is a (slower) overload for std::strings. More...
 
std::string replaceControlCharacters (std::string sToModify)
 This function is a simple wrapper for replaceAll() and specialized to remove control characters from strings. More...
 
std::string replacePathSeparator (const std::string &__sPath)
 This function replaces the Windows style path sparators to UNIX style. More...
 
bool isEqualStripped (StringView str1, StringView str2)
 Returns true, if the contents of the strings are equal, if all surrounding whitespaces will be stripped. More...
 

Function Documentation

◆ condenseText()

std::string condenseText ( const std::string &  sText)

Removes vowels and umlauts from the passed string.

Parameters
sTextconst std::string&
Returns
std::string

Definition at line 412 of file stringtools.cpp.

Referenced by createOutputForHist1D().

◆ detectTimeDateFormat()

int detectTimeDateFormat ( const std::string &  sStr)

Detects the contained date-time format and returns it as a bitflag composition.

Parameters
sStrconst std::string&
Returns
int

Definition at line 1175 of file stringtools.cpp.

References date::format(), isDatePattern_DE(), isDatePattern_US(), isTimePattern(), TD_HHMMSS, TD_NONE, TD_SEP_COLON, TD_SEP_MINUS, TD_UTC, and TD_YYMMDD.

Referenced by StrToTime().

Here is the call graph for this function:

◆ ellipsize()

std::string ellipsize ( const std::string &  sLongString,
size_t  nMaxStringLength 
)

Shortens the passed string by introducing a ellipsis in the middle of the string, if the string is longer than the maximal string length.

Parameters
sLongStringconst std::string&
nMaxStringLengthsize_t
Returns
std::string

Definition at line 1420 of file stringtools.cpp.

Referenced by NumeReDebugger::getGlobals(), NumeRe::Cluster::getShortVectorRepresentation(), and NumeReKernel::getVariableList().

◆ fromSystemCodePage()

std::string fromSystemCodePage ( std::string  sOutput)

Transforms the system code page to the internal one.

Parameters
sOutputstd::string
Returns
std::string

Definition at line 1267 of file stringtools.cpp.

Referenced by Plot::CoordSettings(), Plot::create2dPlot(), Plot::createPlotOrAnimation(), Plot::createStd3dPlot(), Plot::createStdPlot(), fileExists(), listFiles(), FileSystem::setPath(), and NumeReKernel::uninstallPlugin().

◆ getNextArgument()

std::string getNextArgument ( std::string &  sArgList,
bool  bCut 
)

Definition at line 2294 of file tools.cpp.

References getNextCommandLineToken(), and StringViewBase::to_string().

Referenced by NumeReEditor::AbstrahizeSection(), NumeReEditor::AddProcedureDocumentation(), CodeAnalyzer::analyseCommands(), NumeRe::StringFuncHandler::applySpecialStringFuncs(), applyValueHeuristics(), NumeRe::StringFuncHandler::argumentParser(), FlowCtrl::checkCaseValue(), cmd_pack(), cmd_remove(), cmd_rename(), convertVectorToExpression(), Plot::createDataLegends(), ProcedureVarFactory::createLocalClusters(), ProcedureVarFactory::createLocalInlineStrings(), ProcedureVarFactory::createLocalInlineVars(), ProcedureVarFactory::createLocalStrings(), ProcedureVarFactory::createLocalTables(), ProcedureVarFactory::createLocalVars(), createMatFromLines(), createMatFromLinesFilled(), ProcedureVarFactory::createProcedureArguments(), Plot::createSubPlotSet(), NumeReDebugger::decodeType(), deleteCacheEntry(), dialogCommand(), differentiate(), NumeRe::StringParser::eval(), evalMatOp(), ProcedureVarFactory::evaluateProcedureArguments(), NumeRe::StringVarFactory::evaluateStringVectors(), NumeRe::FindProcedureDefinition(), SearchController::FindProcedureDefinitionInLocalFile(), NumeReEditor::GetCurrentArgument(), CommandLineParser::getParameterValueAsNumericalValue(), Script::handleInstallInformation(), Package::importDefinition(), newObject(), FunctionDefinition::parse(), NumeRe::StringParser::parseStringsInIndices(), FlowCtrl::prepareSwitchExpression(), replaceEntityOccurence(), PackageRepoBrowser::resolveDependencies(), Plot::separateFunctionsAndData(), PlotData::setParams(), NumeReWindow::showDirDialog(), NumeReWindow::showFileDialog(), NumeReWindow::showListDialog(), NumeReWindow::showSelectionDialog(), NumeReWindow::showTextEntry(), FunctionDefinition::splitAndValidateArguments(), NumeRe::StringParser::storeStringResults(), swapTables(), tableMethod_anova(), tableMethod_binsof(), tableMethod_categorize(), tableMethod_convert(), tableMethod_counteq(), tableMethod_cov(), tableMethod_findCols(), tableMethod_index(), tableMethod_pcorr(), tableMethod_rank(), tableMethod_scorr(), tableMethod_zscore(), toStrVector(), undefineFunctions(), NumeReKernel::uninstallPlugin(), and writeToFile().

Here is the call graph for this function:

◆ getTimeStamp()

std::string getTimeStamp ( bool  bGetStamp)

This function simple returns the current time as a default timestamp.

Parameters
bGetStampbool
Returns
std::string

Definition at line 1373 of file stringtools.cpp.

References GET_AS_TIMESTAMP, GET_WITH_TEXT, and toString().

Referenced by NumeReHistory::addHeader(), createTeXExport(), fitDataSet(), NumeRe::FileAdapter::getDate(), NumeReEditor::getTemplateContent(), NumeReWindow::NewFile(), prepareTemplate(), Script::startInstallation(), NumeReKernel::StartUp(), NumeRe::TextDataFile::writeHeader(), NumeRe::LaTeXTable::writeHeader(), and Procedure::writeProcedure().

Here is the call graph for this function:

◆ intPower()

double intPower ( double  dNumber,
int  nExponent 
)

This function calculates the power of a value with the specialization that the exponent is an integer.

Parameters
dNumberdouble
nExponentint
Returns
double

Definition at line 3607 of file tools.cpp.

References date::abs().

Referenced by StrToTime().

Here is the call graph for this function:

◆ intToVersion()

std::string intToVersion ( size_t  nVersionDigits)

Converts a multi-digit integer into a verison string.

Parameters
nVersionDigitssize_t
Returns
std::string

Definition at line 815 of file stringtools.cpp.

References toString().

Referenced by incrementVersion().

Here is the call graph for this function:

◆ isConvertible()

bool isConvertible ( const std::string &  sStr,
ConvertibleType  type 
)

This function checks, whether a string can be converted to the selected ConvertibleType.

Parameters
sStrconst std::string&
typeConvertibleType
Returns
bool

Definition at line 1009 of file stringtools.cpp.

References CONVTYPE_DATE_TIME, CONVTYPE_LOGICAL, CONVTYPE_VALUE, isConvertible(), isDateTimePattern(), and toLowerCase().

Referenced by StringColumn::convert(), CategoricalColumn::convert(), NumeRe::ClusterStringItem::getDouble(), isConvertible(), NumeRe::GenericFile::isNumeric(), NumeRe::Table::isNumerical(), CellValueShaderDialog::OnButtonClick(), NumeRe::CommaSeparatedValues::readFile(), NumeRe::ClusterDoubleItem::setString(), ValueColumn::setValue(), DateTimeColumn::setValue(), LogicalColumn::setValue(), NumeRe::Table::setValueAsString(), strfnc_textparse(), and strfnc_to_time().

Here is the call graph for this function:

◆ isDatePattern_DE()

static int isDatePattern_DE ( const std::string &  sStr,
size_t  i 
)
static

Returns a formatting flag combination, if the string is a DE-specific date pattern or TD_NONE.

Parameters
sStrconst std::string&
isize_t
Returns
int

Definition at line 1121 of file stringtools.cpp.

References TD_DDMM, TD_DDMMYY, TD_NONE, and TD_SEP_DOT.

Referenced by detectTimeDateFormat().

◆ isDatePattern_US()

static int isDatePattern_US ( const std::string &  sStr,
size_t  i 
)
static

Returns a formatting flag combination, if the string is a US-specific date pattern or TD_NONE.

Parameters
sStrconst std::string&
isize_t
Returns
int

Definition at line 1088 of file stringtools.cpp.

References TD_DDMMYY, TD_NONE, TD_SEP_MINUS, TD_SEP_SLASH, and TD_YYMMDD.

Referenced by detectTimeDateFormat().

◆ isDateTimePattern()

static bool isDateTimePattern ( const std::string &  sStr,
size_t  pos 
)
static

Static function to determine, whether the character at passed position fits the pattern needed for a date.

Parameters
sStrconst std::string&
possize_t
Returns
bool

Definition at line 984 of file stringtools.cpp.

Referenced by isConvertible().

◆ isEqualStripped()

bool isEqualStripped ( StringView  str1,
StringView  str2 
)

Returns true, if the contents of the strings are equal, if all surrounding whitespaces will be stripped.

Parameters
str1StringView
str2StringView
Returns
bool

Definition at line 1574 of file stringtools.cpp.

References StringViewBase::strip().

Referenced by evalMatOp().

Here is the call graph for this function:

◆ isTimePattern()

static int isTimePattern ( const std::string &  sStr,
size_t  i 
)
static

Returns a formatting flag combination, if the string is a time pattern or TD_NONE.

Parameters
sStrconst std::string&
isize_t
Returns
int

Definition at line 1150 of file stringtools.cpp.

References TD_HHMM, TD_HHMMSS, TD_NONE, and TD_SEP_COLON.

Referenced by detectTimeDateFormat().

◆ replaceAll() [1/2]

void replaceAll ( std::string &  sToModify,
const char *  sToRep,
const char *  sNewValue,
size_t  nStart,
size_t  nEnd 
)

This function replaces all occurences of the string sToRep in the string sToModify with the new value sNewValue. The boundaries limit the range of processing.

Parameters
sToModifystd::string&
sToRepconst char*
sNewValueconst char*
nStartsize_t
nEndsize_t
Returns
void

Definition at line 1443 of file stringtools.cpp.

Referenced by NumeRe::addLinebreaks(), NumeReEditor::AddProcedureDocumentation(), applySyntaxHighlighting(), StringColumn::convert(), CategoricalColumn::convert(), createCssString(), DocumentationGenerator::createMainProcedure(), DocumentationGenerator::createParametersTable(), DocumentationGenerator::createReturnsTable(), NumeRe::StringParser::createTerminalOutput(), NumeRe::TextDataFile::decodeTableHeads(), Dependencies::Dependencies(), PackageRepoBrowser::DetectInstalledPackages(), NumeReKernel::failMessage(), formatNumberToTex(), getHighlightedCode(), NumeReKernel::getPluginLanguageStrings(), NumeReKernel::issueWarning(), listDirectory(), NumeRe::StringParser::maskControlCharacters(), newObject(), NumeReWindow::OnCreatePackage(), openExternally(), DocumentationGenerator::parseDocumentation(), parseEventOpt(), parseLayoutCommand(), parseLayoutScript(), PackageRepoBrowser::populatePackageList(), NumeRe::TextDataFile::readFile(), readFromFile(), NumeRe::JcampDX::readTable(), replaceControlCharacters(), Dependencies::resolveProcedureCalls(), FlowCtrl::setCommand(), strfnc_replaceall(), strfnc_textparse(), toExternalString(), urlExecute(), versionToInt(), and Script::writeWholeFile().

◆ replaceAll() [2/2]

void replaceAll ( std::string &  sToModify,
const std::string &  sToRep,
const std::string &  sNewValue,
size_t  nStart,
size_t  nEnd 
)

This function replaces all occurences of the string sToRep in the string sToModify with the new value sNewValue. The boundaries limit the range of processing. This function is a (slower) overload for std::strings.

Parameters
sToModifystd::string&
sToRepconst std::string&
sNewValueconst std::string&
nStartsize_t
nEndsize_t
Returns
void

Definition at line 1490 of file stringtools.cpp.

◆ replaceControlCharacters()

std::string replaceControlCharacters ( std::string  sToModify)

This function is a simple wrapper for replaceAll() and specialized to remove control characters from strings.

Parameters
sToModifystd::string
Returns
std::string

Definition at line 1531 of file stringtools.cpp.

References replaceAll().

Referenced by NumeReDebugger::decodeType(), NumeReDebugger::getGlobals(), GridNumeReTable::GetValue(), NumeReKernel::getVariableList(), and TableViewer::SetData().

Here is the call graph for this function:

◆ replacePathSeparator()

std::string replacePathSeparator ( const std::string &  __sPath)

◆ split()

std::vector< std::string > split ( const std::string &  sStr,
char  cSplit 
)

Splits a vector at the selected characters.

Parameters
sStrconst std::string&
cSplitchar
Returns
std::vector<std::string>

Definition at line 1388 of file stringtools.cpp.

Referenced by date::detail::Rule::split_overlaps(), and StrToTime().

◆ StripSpaces()

void StripSpaces ( std::string &  sToStrip)

Removes leading and trailing white spaces and tabulator characters.

Parameters
sToStripstd::string&
Returns
void

Definition at line 463 of file stringtools.cpp.

Referenced by NumeReEditor::AbstrahizeSection(), PackageManager::addHelpIndex(), addLegends(), CodeAnalyzer::analyseCommands(), CodeAnalyzer::analyseFunctions(), NumeRe::StringParser::applyElementaryStringOperations(), NumeRe::StringFuncHandler::applySpecialStringFuncs(), applyValueHeuristics(), FlowCtrl::calc(), FunctionDefinitionManager::call(), FlowCtrl::checkParsingModeAndExpandDefinitions(), ProcedureElement::cleanCurrentLine(), FileSystem::cleanPath(), cmd_ifndefined(), cmd_install(), cmd_readline(), cmd_rename(), commandHandler(), FlowCtrl::compile(), NumeRe::StringLogicParser::concatenateStrings(), confirmOperation(), Plot::create2dPlot(), Plot::createDataLegends(), ProcedureVarFactory::createLocalClusters(), ProcedureVarFactory::createLocalInlineStrings(), ProcedureVarFactory::createLocalInlineVars(), ProcedureVarFactory::createLocalStrings(), ProcedureVarFactory::createLocalTables(), ProcedureVarFactory::createLocalVars(), ProcedureVarFactory::createProcedureArguments(), Plot::createStd3dPlot(), Plot::createStdPlot(), Plot::createSubPlotSet(), SymDefManager::createSymbol(), FunctionDefinition::decodeDefinition(), decodeNameSpace(), deleteCacheEntry(), differentiate(), doc_Help(), doc_HelpAsHTML(), editObject(), NumeRe::StringParser::eval(), FlowCtrl::evalHeader(), PackageManager::evalPluginCmd(), FlowCtrl::evalRangeBasedHeader(), NumeRe::StringLogicParser::evalStringLogic(), NumeRe::StringLogicParser::evalStringTernary(), evaluateFittingParams(), ProcedureVarFactory::evaluateProcedureArguments(), NumeReKernel::evaluateProcedureCalls(), Plot::evaluateSubplot(), Procedure::execute(), executeCommand(), NumeReKernel::executePlugins(), FlowCtrl::extractFlagsAndIndexVariables(), FlowCtrl::fillJumpTableAndExpandRecursives(), findArticleById(), findCommand(), findExtrema(), NumeRe::FindProcedureDefinition(), SearchController::FindProcedureDefinitionInLocalFile(), findZeroes(), fitDataSet(), FlowCtrl::for_loop(), Documentation::getArgAtPos(), getArgAtPos(), getDataElements(), NumeRe::StringParser::getDataForString(), NumeRe::DataBase::getDBFileContent(), FunctionDefinition::getDefinition(), CommandLineParser::getExprAsFileName(), CommandLineParser::getExprAsMathExpression(), Fitcontroller::getFitFunction(), getIndices(), Procedure::getInlined(), getIntervalForSearchFunctions(), Language::getLangFileContent(), getLastToken(), NumeReKernel::getline(), Includer::getNextLine(), Script::getNextScriptCommandFromScript(), Package::getOptionValue(), getParameterValue(), CommandLineParser::getParameterValueAsString(), NumeReKernel::handleCommandLineSource(), Procedure::handleIncludeSyntax(), Script::handleInstallInformation(), NumeReKernel::handleToCmd(), FunctionDefinition::importFunction(), isClusterCandidate(), FunctionDefinitionManager::isDefined(), listDirectory(), listFiles(), load_data(), loadDocumentationArticle(), DocumentationFile::loadFromFile(), PackageManager::loadPlugins(), NumeReKernel::MainLoop(), moveOrCopyFiles(), Includer::openIncludedFile(), FunctionDefinition::parse(), CommandLineParser::parse(), MemoryManager::parseEvery(), CommandLineParser::parseExprAsString(), parseLayoutCommand(), parseLayoutScript(), mu::ParserBase::ParseString(), parseStringOpt(), performMatrixOperation(), Plot::Plot(), plugin_histogram(), NumeRe::StringLogicParser::prepareComparisonValues(), FlowCtrl::prepareLocalVarsAndReplace(), Procedure::ProcCalc(), Procedure::procedureCmdInterface(), ProcedureElement::ProcedureElement(), Procedure::procedureInterface(), promptForUserInput(), FlowCtrl::range_based_for_loop(), NumeRe::CassyLabx::readFile(), NumeRe::CommaSeparatedValues::readFile(), NumeRe::JcampDX::readFile(), readFromFile(), NumeRe::JcampDX::readTable(), NumeRe::realignLangString(), removeObsoleteParentheses(), NumeRe::StringParser::replaceDataOccurence(), FlowCtrl::replaceLocalVars(), Procedure::replaceReturnVal(), replaceToTeX(), FunctionDefinitionManager::resolveRecursiveDefinitions(), CodeAnalyzer::run(), Plot::separateFunctionsAndData(), Settings::set(), FlowCtrl::setCommand(), PlotData::setParams(), Odesolver::solve(), NumeReEditor::sortSelection(), NumeRe::StringExpression::split(), FunctionDefinition::splitAndValidateArguments(), Script::startInstallation(), NumeRe::StringParser::storeStringResults(), strfnc_textparse(), stripComments(), StrToTime(), swapTables(), taylor(), windowCommand(), Script::writeDocumentationArticle(), Script::writeLayout(), Script::writeProcedure(), Procedure::writeProcedure(), and writeToFile().

◆ StrToCmplx()

std::complex< double > StrToCmplx ( const std::string &  sString)

Converts a string into a complex number.

Parameters
sStringstd::string& const
Returns
std::complex<double>

Definition at line 528 of file stringtools.cpp.

References fast_float::from_chars_result::ec, fast_float::from_chars(), fast_float::from_chars_result::ptr, and toLowerCase().

Referenced by TableViewer::CellToCmplx(), StringColumn::convert(), CategoricalColumn::convert(), NumeRe::ClusterStringItem::getDouble(), CellValueShaderDialog::OnButtonClick(), NumeRe::ClusterDoubleItem::setString(), ValueColumn::setValue(), NumeRe::Table::setValueAsString(), strfnc_textparse(), and StrToLogical().

Here is the call graph for this function:

◆ StrToDb()

◆ StrToInt()

◆ StrToLogical()

double StrToLogical ( const std::string &  sString)

Converts a string into a double considering logical values.

Parameters
sStringconst std::string&
Returns
double

Definition at line 509 of file stringtools.cpp.

References StrToCmplx(), and toLowerCase().

Referenced by StringColumn::convert(), CategoricalColumn::convert(), LogicalColumn::setValue(), and NumeRe::Table::setValueAsString().

Here is the call graph for this function:

◆ StrToTime()

sys_time_point StrToTime ( const std::string &  sString)

◆ toCmdString() [1/2]

std::string toCmdString ( const std::complex< double > &  dNumber)

Converts a numerical value into a "full" precision string.

Parameters
dNumberconst std::complex<double>&
Returns
std::string

Definition at line 325 of file stringtools.cpp.

References toString().

Here is the call graph for this function:

◆ toCmdString() [2/2]

◆ toExternalString()

std::string toExternalString ( std::string  sStr)

Converts an internal string to the external representation in the terminal.

Parameters
sStrstd::string
Returns
std::string

Definition at line 881 of file stringtools.cpp.

References replaceAll().

Referenced by NumeReDebugger::gatherLoopBasedInformations(), NumeReDebugger::getGlobals(), NumeRe::ClusterDoubleItem::getString(), NumeRe::ClusterStringItem::getString(), StringColumn::getValueAsStringLiteral(), and NumeReKernel::getVariableList().

Here is the call graph for this function:

◆ toHexString()

std::string toHexString ( int  nNumber)

Converts an integer to a hexadecimal number printed as string.

Parameters
nNumberint
Returns
std::string

Definition at line 339 of file stringtools.cpp.

References fast_float::hex.

Referenced by mu::ParserByteCode::AsciiDump(), and NumeReKernel::initializeStackTracker().

◆ toInternalString()

std::string toInternalString ( std::string  sStr)

Converts a string literal to the internal representation in tables and clusters.

Parameters
sStrstd::string
Returns
std::string

Definition at line 844 of file stringtools.cpp.

Referenced by ProcedureVarFactory::createLocalInlineStrings(), StringVector::makeLocalString(), CommandLineParser::parseExprAsString(), NumeRe::ClusterDoubleItem::setString(), ValueColumn::setValue(), DateTimeColumn::setValue(), and LogicalColumn::setValue().

◆ toIntVector()

std::vector< int > toIntVector ( std::string  sString)

This function converts a std::string into a std::vector, where the string shall be passed as "{x,y,z,...}".

Parameters
sStringstd::string
Returns
std::vector<int>

Definition at line 387 of file stringtools.cpp.

References StrToInt(), and toStrVector().

Referenced by NumeReWindow::prepareSession().

Here is the call graph for this function:

◆ toLowerCase()

◆ toString() [1/10]

std::string toString ( __time64_t  tTime,
int  timeStampFlags 
)

Converts a time_t to a string. Will actually print a timestamp.

Parameters
tTime__time64_t
timeStampFlagsint
Returns
std::string

Definition at line 150 of file stringtools.cpp.

References _lang, Language::get(), GET_AS_TIMESTAMP, GET_ONLY_TIME, GET_WITH_TEXT, and getCurrentTimeZone().

Here is the call graph for this function:

◆ toString() [2/10]

std::string toString ( bool  bBoolean)

Converts a boolean to a string by actually converting the numerical value to "true" and "false".

Parameters
bBooleanbool
Returns
std::string

Definition at line 291 of file stringtools.cpp.

◆ toString() [3/10]

std::string toString ( const std::complex< double > &  dNumber,
int  nPrecision 
)

Converts a complex number into a printable string.

Parameters
dNumberconst std::complex<double>&
nPrecisionint
Returns
sstd::tring

Definition at line 90 of file stringtools.cpp.

References mu::isinf(), mu::isnan(), and mu::rint().

Here is the call graph for this function:

◆ toString() [4/10]

std::string toString ( double  dNumber,
const Settings _option 
)

Converts a double to a string using the precision from the Settings object.

Parameters
dNumberdouble
_optionconst Settings&
Returns
std::string

Definition at line 58 of file stringtools.cpp.

References Settings::getPrecision(), and toString().

Here is the call graph for this function:

◆ toString() [5/10]

std::string toString ( double  dNumber,
int  nPrecision 
)

Converts a double to a string using the passed precision.

Parameters
dNumberdouble
nPrecisionint
Returns
std::string

Definition at line 73 of file stringtools.cpp.

◆ toString() [6/10]

std::string toString ( int  nNumber)

Converts an integer to a string without the Settings bloat.

Parameters
nNumberint
Returns
std::string

Definition at line 121 of file stringtools.cpp.

References toString().

Referenced by CodeAnalyzer::analyseCommands(), analyzePulse(), append_data(), NumeRe::StringFuncHandler::applySpecialStringFuncs(), mu::ParserByteCode::AsciiDump(), calculate2dFFT(), calculateChiMap(), calculateSplines(), cartToCyl(), cartToPolar(), Procedure::catchExceptionForTest(), NumeReWindow::CloseAllFiles(), cmd_delete(), cmd_get(), cmd_load(), cmd_set(), cmd_show(), cmd_warn(), constructCovarianceMatrix(), ValueColumn::convert(), DateTimeColumn::convert(), convertToString(), FunctionDefinition::convertToValues(), Plot::CoordFunc(), coordsToGrid(), Plot::create2dPlot(), createDatagrid(), FileRevisions::createDiff(), DependencyDialog::CreateDotFile(), CellValueShaderDialog::createIntervalExclPage(), CellValueShaderDialog::createIntervalPage(), ProcedureVarFactory::createLocalInlineStrings(), ProcedureVarFactory::createLocalInlineVars(), ProcedureVarFactory::createMangledArgName(), ProcedureVarFactory::createMangledVarName(), FileRevisions::createNewRevision(), FileRevisions::createNewTag(), createOutputForHist1D(), createOutputForHist2D(), Plot::createPlotOrAnimation(), createStatsFile(), createStatsOutput(), NumeRe::StringVarFactory::createStringVectorVar(), NumeRe::ClusterManager::createTemporaryCluster(), NumeRe::StringVarFactory::createTempStringVectorVar(), NumeRe::StringParser::createTerminalOutput(), createTeXExport(), cylToCart(), cylToPolar(), NumeReDebugger::decodeType(), determineWindowSize(), doc_SearchFct(), CombinedCellEditor::EndEdit(), NumeReEditor::Entry(), mu::ParserBase::Eval(), evalMatOp(), NumeRe::StringLogicParser::evalStringLogic(), evaluateExpression(), evaluateParameterValues(), ProcedureVarFactory::evaluateProcedureArguments(), NumeReKernel::evaluateProcedureCalls(), NumeRe::StringParser::evaluateStack(), NumeRe::StringVarFactory::evaluateStringVectors(), Procedure::execute(), Plot::expandStyleForCurveArray(), NumeReEditor::ExtractAsHTML(), fastFourierTransform(), RenameSymbolsDialog::fillChangesLog(), findExtrema(), SearchController::FindProceduresInCurrentFile(), FlowCtrl::for_loop(), Output::format(), formatByteSize(), formatMatrixRow(), NumeRe::LaTeXTable::formatNumber(), formatNumberToTex(), NumeReKernel::formatResultOutput(), NumeReEditor::generateAutoCompList(), generateTemplate(), Language::get(), NumeReSyntax::getAutoCompList(), NumeReSyntax::getAutoCompListCPP(), NumeReSyntax::getAutoCompListMATLAB(), NumeReSyntax::getAutoCompListTeX(), Memory::getCategoryList(), GridNumeReTable::GetColLabelValue(), getDataForFit(), NumeRe::StringParser::getDataForString(), TableColumn::getDefaultColumnHead(), getErrorType(), getFileInfo(), Fitcontroller::getFitFunction(), getFitOptionsTable(), NumeReDebugger::getGlobals(), Documentation::getHelpArticle(), NumeRe::ClusterDoubleItem::getInternalString(), NumeReDebugger::getModuleInformations(), NumeReSyntax::getNameSpaceAutoCompList(), mu::ParserBase::getNextVectorVarIndex(), NumeReDebugger::getNumVars(), getParameterTable(), PlotData::getParams(), NumeReSyntax::getProcAutoCompList(), StringVector::getRef(), FileRevisions::getRevision(), GridNumeReTable::GetRowLabelValue(), NumeRe::Cluster::getShortVectorRepresentation(), NumeReDebugger::getStackTrace(), NumeRe::ClusterDoubleItem::getString(), NumeReKernel::getStringTable(), EditorNotebook::GetTabFromPoint(), DateTimeColumn::getValueAsInternalString(), ValueColumn::getValueAsString(), CategoricalColumn::getValueAsString(), NumeReKernel::getVariableList(), getVarList(), NumeRe::NumeReDataFile::getVersionString(), NumeReWindow::gotoLine(), CustomWindow::handleEvent(), Script::handleInstallInformation(), integrate(), integrate2d(), listConstants(), listDeclaredVariables(), listDefinitions(), listDirectory(), FunctionDefinitionManager::load(), NumeReKernel::MainLoop(), make_stringmatrix(), matrixReshape(), moveOrCopyFiles(), Odesolver::odeFunction(), NumeReWindow::OnCalculateDependencies(), NumeReWindow::OnCreatePackage(), MyApp::OnExceptionInMainLoop(), NumeReWindow::OnFileEventTimer(), NumeReWindow::OnFindEvent(), EditorNotebook::OnTabRightClicked(), NumeRe::FileAdapter::openFile(), Matrix::operator()(), padWithZeros(), parseArg(), NumeRe::JcampDX::parseLine(), parser_declareDataMatrixValuesForIndices(), parser_declareMatrixReturnValuesForIndices(), mu::ParserBase::PauseLoopMode(), Plot::plotstd3d(), plugin_random(), polarToCart(), polarToCyl(), FlowCtrl::prepareLocalVarsAndReplace(), prepareTicksForHist1d(), Matrix::printDims(), NumeRe::StringFuncHandler::printValue(), mu::printVector(), ProcedureElement::ProcedureElement(), Procedure::procedureInterface(), NumeReKernel::progressBar(), StringVector::push_back(), DetachedLogger::push_line(), FlowCtrl::range_based_for_loop(), NumeRe::XLSXSpreadSheet::readFile(), NumeRe::IgorBinaryWave::readFile(), NumeRe::ZygoDat::readFile(), readImage(), NumeRe::JcampDX::readTable(), TextManager::renderLayout(), NumeReKernel::resetAfterError(), FileRevisions::restoreRevision(), CodeAnalyzer::run(), seekInAudioFile(), FlowCtrl::setCommand(), TableViewer::SetData(), NumeRe::ClusterStringItem::setDouble(), setParametersInWindow(), DuplicateCodeDialog::SetResult(), StringColumn::setValue(), CategoricalColumn::setValue(), shortTimeFourierAnalysis(), showMatrixResult(), Odesolver::solve(), solveLGSSymbolic(), NumeReEditor::sortSelection(), mu::ParserBase::StackDump(), Timer::Stop(), NumeRe::StringParser::storeStringResults(), strfnc_basetodec(), strfnc_cnt(), strfnc_findparam(), strfnc_findtoken(), strfnc_getmatchingparens(), strfnc_getversioninfo(), strfnc_num(), strfnc_regex(), strfnc_str_not_match(), strfnc_str_not_rmatch(), strfnc_strfnd(), strfnc_strlen(), strfnc_strmatch(), strfnc_strrfnd(), strfnc_strrmatch(), strfnc_sum(), strfnc_timeformat(), tableMethod_anova(), FileRevisions::tagRevision(), taylor(), NumeReDebugger::throwException(), SyntaxStyles::to_string(), VectorIndex::to_string(), FileRevisions::undoRevision(), TablePanel::update(), ProcedureViewer::updateProcedureList(), TableViewer::updateStatusBar(), VariableViewer::UpdateVariables(), urlExecute(), windowCommand(), DetachedLogger::write_system_information(), NumeRe::CommaSeparatedValues::writeFile(), NumeRe::LaTeXTable::writeFile(), and NumeRe::TextDataFile::writeTableContents().

Here is the call graph for this function:

◆ toString() [7/10]

std::string toString ( int  nNumber,
const Settings _option 
)

Converts an integer to a string.

Parameters
nNumberint
_optionconst Settings&
Returns
std::string

Definition at line 43 of file stringtools.cpp.

References toString().

Referenced by getTimeStamp(), intToVersion(), toCmdString(), and toString().

Here is the call graph for this function:

◆ toString() [8/10]

std::string toString ( long long int  nNumber)

Converts a long long int to a string.

Parameters
nNumberlong longint
Returns
string

Definition at line 274 of file stringtools.cpp.

◆ toString() [9/10]

std::string toString ( size_t  nNumber)

Converts an unsigned integer to a string.

Parameters
nNumbersize_t
Returns
std::string

Definition at line 135 of file stringtools.cpp.

References toString().

Here is the call graph for this function:

◆ toString() [10/10]

std::string toString ( sys_time_point  tp,
int  timeStampFlags 
)

Converts a sys_time_point to a string.

Parameters
tpsys_time_point
timeStampFlagsint
Returns
std::string

Definition at line 210 of file stringtools.cpp.

References _lang, date::year_month_day::day(), Language::get(), GET_AS_TIMESTAMP, GET_FULL_PRECISION, GET_MILLISECONDS, GET_ONLY_TIME, GET_WITH_TEXT, getCurrentTimeZone(), getTimeStampFromTimePoint(), time_stamp::m_hours, time_stamp::m_microsecs, time_stamp::m_millisecs, time_stamp::m_minutes, time_stamp::m_seconds, time_stamp::m_ymd, date::year_month_day::month(), and date::year_month_day::year().

Here is the call graph for this function:

◆ toStrVector()

std::vector< std::string > toStrVector ( std::string  sString)

This function converts a std::string into a std::vector, where the string shall be passed as "{x,y,z,...}".

Parameters
sStringstd::string
Returns
std::vector<std::string>

Definition at line 356 of file stringtools.cpp.

References getNextArgument().

Referenced by CellValueShaderDialog::OnButtonClick(), and toIntVector().

Here is the call graph for this function:

◆ toSystemCodePage()

◆ toUpperCase()

◆ truncString()

std::string truncString ( const std::string &  sText,
size_t  nMaxChars 
)

This function truncates the string to the passed max length (including a trailing ellipsis) or returns it unmodified, if it is shorter.

Parameters
sTextconst std::string&
nMaxCharssize_t
Returns
std::string

Definition at line 446 of file stringtools.cpp.

Referenced by NumeReKernel::formatResultOutput().

◆ utf8parser()

std::string utf8parser ( const std::string &  sString)

Transforms a UTF8 encoded string into a standard ASCII string in the internal code page representation.

Parameters
sStringconst std::string&
Returns
std::string

Definition at line 1307 of file stringtools.cpp.

Referenced by NumeRe::TextDataFile::decodeTableHeads(), NumeRe::CassyLabx::readFile(), NumeRe::CommaSeparatedValues::readFile(), NumeRe::OpenDocumentSpreadSheet::readFile(), NumeRe::XLSSpreadSheet::readFile(), and NumeRe::XLSXSpreadSheet::readFile().

◆ versionToInt()

size_t versionToInt ( std::string  sVersion)

Converts a version string into a multi-digit integer.

Parameters
sVersionstd::string
Returns
size_t

Definition at line 795 of file stringtools.cpp.

References replaceAll(), StrToInt(), and sVersion.

Referenced by PackageRepoBrowser::DetectInstalledPackages(), Script::handleInstallInformation(), and incrementVersion().

Here is the call graph for this function:

◆ wcstombs()

std::string wcstombs ( const std::wstring &  wStr)

This function is a wrapper for the usual wcstombs function, which can handle wstrings.

Parameters
wStrconst std::wstring&
Returns
std::string

Definition at line 1222 of file stringtools.cpp.

References wcstombs().

Referenced by YExcel::LargeString::ContinueRead(), YCompoundFiles::Block::Create(), YCompoundFiles::Block::Open(), YCompoundFiles::CompoundFile::PresentWorkingDirectory(), NumeRe::XLSSpreadSheet::readFile(), and wcstombs().

Here is the call graph for this function: