BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
StringUtils.h File Reference

Description

Defines a few helper functions.

Homepage:\n http://www.bornagainproject.org
License:\n GNU General Public License v3 or higher (see COPYING)
Authors
Scientific Computing Group at MLZ (see CITATION, AUTHORS)

Definition in file StringUtils.h.

Include dependency graph for StringUtils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 BaseUtils
 
 BaseUtils::String
 Utility functions to analyze or modify strings.
 

Macros

#define BORNAGAIN_BASE_UTIL_STRINGUTILS_H
 

Functions

std::string BaseUtils::String::join (const std::vector< std::string > &joinable, const std::string &joint)
 Returns string obtain by joining vector elements. More...
 
std::string BaseUtils::String::padRight (const std::string &name, size_t length)
 Returns string right-padded with blanks. More...
 
void BaseUtils::String::replaceItemsFromString (std::string &text, const std::vector< std::string > &items, const std::string &replacement="")
 Replaces all occurrences of items from string text with delimiter. More...
 
template<typename T >
std::string BaseUtils::String::scientific (T value, int n=10)
 Returns scientific string representing given value of any numeric type. More...
 
std::vector< std::string > BaseUtils::String::split (const std::string &text, const std::string &delimiter)
 Split string into vector of string using delimiter. More...
 
bool BaseUtils::String::startsWith (const std::string &str, const std::string &substr)
 True if the string starts with substr. The comparison is case sensitive. More...
 
bool BaseUtils::String::to_int (const std::string &str, int *result)
 Interprets the contained text as an integer and returns it in result. Space chars at its begin and end will be ignored. If the conversion result is of no interest, but only the convertibility, then you can set result to nullptr. The conversion is assumed to be successful if: More...
 
std::string BaseUtils::String::to_lower (std::string text)
 Returns new string which is lower case of text. More...
 
std::string BaseUtils::String::trim (const std::string &str, const std::string &whitespace=" \t")
 Cuts any of the chars given in whitespace from start and end of str. More...
 
std::string BaseUtils::String::trimFront (const std::string &str, const std::string &whitespace=" \t")
 Cuts any of the chars given in whitespace from start. More...
 

Macro Definition Documentation

◆ BORNAGAIN_BASE_UTIL_STRINGUTILS_H

#define BORNAGAIN_BASE_UTIL_STRINGUTILS_H

Definition at line 21 of file StringUtils.h.