Mantid
Loading...
Searching...
No Matches
Namespaces | Functions
Strings.cpp File Reference
#include "MantidKernel/Strings.h"
#include "MantidKernel/StringTokenizer.h"
#include "MantidKernel/UnitLabel.h"
#include <Poco/Path.h>
#include <boost/algorithm/string.hpp>
#include <memory>
#include <fstream>

Go to the source code of this file.

Namespaces

namespace  Mantid
 Helper class which provides the Collimation Length for SANS instruments.
 
namespace  Mantid::Kernel
 
namespace  Mantid::Kernel::Strings
 Holds support functions for strings.
 

Functions

MANTID_KERNEL_DLL int Mantid::Kernel::Strings::confirmStr (const std::string &S, const std::string &fullPhrase)
 determine if a character group exists in a string More...
 
template<typename T >
int Mantid::Kernel::Strings::convert (const char *A, T &out)
 Convert a char* into a number. More...
 
template<typename T >
int Mantid::Kernel::Strings::convert (const std::string &A, T &out)
 Convert a string into a number. More...
 
template<typename T >
int Mantid::Kernel::Strings::convPartNum (const std::string &A, T &out)
 Takes a character string and evaluates the first [typename T] object. More...
 
MANTID_KERNEL_DLL int Mantid::Kernel::Strings::endsWithInt (const std::string &word)
 Get an int from the end of a word. More...
 
MANTID_KERNEL_DLL std::istream & Mantid::Kernel::Strings::extractToEOL (std::istream &is, std::string &str)
 Extract a line from input stream, discarding any EOL characters encountered. More...
 
MANTID_KERNEL_DLL int Mantid::Kernel::Strings::extractWord (std::string &Line, const std::string &Word, const int cnt=4)
 Get a word from a string. More...
 
MANTID_KERNEL_DLL std::string Mantid::Kernel::Strings::fullBlock (const std::string &A)
 strip pre/post spaces More...
 
MANTID_KERNEL_DLL std::string Mantid::Kernel::Strings::getLine (std::istream &fh)
 Get a line and strip comments Use only for a single call. More...
 
MANTID_KERNEL_DLL void Mantid::Kernel::Strings::getLine (std::istream &fh, std::string &Line)
 Get a line and strip comments Use within a loop. More...
 
MANTID_KERNEL_DLL int Mantid::Kernel::Strings::getPartLine (std::istream &fh, std::string &Out, std::string &Excess, const int spc=256)
 get a part of a long line More...
 
float Mantid::Kernel::Strings::getVAXnum (const float A)
 Convert a VAX number to x86 little eindien. More...
 
MANTID_KERNEL_DLL std::string Mantid::Kernel::Strings::getWord (std::istream &in, bool consumeEOL)
 Returns the next word in the stream. More...
 
MANTID_KERNEL_DLL int Mantid::Kernel::Strings::isEmpty (const std::string &A)
 Determines if a string is only spaces. More...
 
MANTID_KERNEL_DLL int Mantid::Kernel::Strings::isMember (const std::vector< std::string > &group, const std::string &candidate)
 checks if the candidate is the member of the group More...
 
MANTID_KERNEL_DLL std::string Mantid::Kernel::Strings::loadFile (const std::string &filename)
 Loads the entire contents of a text file into a string. More...
 
MANTID_KERNEL_DLL std::vector< int > Mantid::Kernel::Strings::parseRange (const std::string &str, const std::string &elemSep=",", const std::string &rangeSep="-")
 Parses a number range, e.g. More...
 
MANTID_KERNEL_DLL std::string Mantid::Kernel::Strings::peekLine (std::istream &fh)
 Peek at a line without extracting it from the stream. More...
 
void Mantid::Kernel::Strings::printHex (std::ostream &OFS, const int n)
 Function to convert a number into hex output (and leave the stream un-changed) More...
 
MANTID_KERNEL_DLL void Mantid::Kernel::Strings::readToEndOfLine (std::istream &in, bool ConsumeEOL)
 Eat everything from the stream until the next EOL. More...
 
MANTID_KERNEL_DLL std::string Mantid::Kernel::Strings::removeSpace (const std::string &CLine)
 strip all spaces More...
 
MANTID_KERNEL_DLL std::string Mantid::Kernel::Strings::replace (const std::string &input, const std::string &find_what, const std::string &replace_with)
 Return a string with all matching occurence-strings. More...
 
MANTID_KERNEL_DLL std::string Mantid::Kernel::Strings::replaceAll (const std::string &input, const std::string &charStr, const std::string &substitute)
 Return a string with all occurrences of the characters in the input replaced by the replace string. More...
 
template<typename T >
int Mantid::Kernel::Strings::section (char *cA, T &out)
 Convert and cut a char*. More...
 
template<typename T >
int Mantid::Kernel::Strings::section (std::string &A, T &out)
 Convert and cut a string. More...
 
template<typename T >
int Mantid::Kernel::Strings::sectionMCNPX (std::string &A, T &out)
 Convert and cut a string for MCNPX. More...
 
template<typename T >
int Mantid::Kernel::Strings::sectPartNum (std::string &A, T &out)
 Convert and cut a string. More...
 
template<typename T >
int Mantid::Kernel::Strings::setValues (const std::string &Line, const std::vector< int > &Index, std::vector< T > &Out)
 Call to read in various values in position x1,x2,x3 from the line. More...
 
MANTID_KERNEL_DLL std::string Mantid::Kernel::Strings::shorten (const std::string &input, const size_t max_length)
 Converts long strings into "start ... end". More...
 
MANTID_KERNEL_DLL bool Mantid::Kernel::Strings::skipLine (const std::string &line)
 Determines if a string starts with a #. More...
 
MANTID_KERNEL_DLL size_t Mantid::Kernel::Strings::split_path (const std::string &path, std::vector< std::string > &path_components)
 function parses a path, found in input string "path" and returns vector of the folders contributed into the path *‍/ More...
 
MANTID_KERNEL_DLL std::map< std::string, std::string > Mantid::Kernel::Strings::splitToKeyValues (const std::string &input, const std::string &keyValSep="=", const std::string &listSep=",")
 Splits a string into key value pairs. More...
 
MANTID_KERNEL_DLL std::string Mantid::Kernel::Strings::strip (const std::string &A)
 strip pre/post spaces More...
 
MANTID_KERNEL_DLL void Mantid::Kernel::Strings::stripComment (std::string &A)
 strip trailling comments More...
 
std::string Mantid::Kernel::Strings::stripMultSpc (const std::string &Line)
 Removes the multiple spaces in the line. More...
 
MANTID_KERNEL_DLL std::vector< std::string > Mantid::Kernel::Strings::StrParts (const std::string &Ln)
 Split tring into spc deliminated components. More...
 
MANTID_KERNEL_DLL std::string Mantid::Kernel::Strings::toLower (const std::string &input)
 Converts string to all lowercase. More...
 
template<typename T >
std::string Mantid::Kernel::Strings::toString (const std::set< T > &value)
 Convert a set to a string. More...
 
template<>
MANTID_KERNEL_DLL std::string Mantid::Kernel::Strings::toString (const std::vector< std::string > &value)
 Template overload for a vector of strings. More...
 
template<typename T >
std::string Mantid::Kernel::Strings::toString (const std::vector< T > &value)
 Convert a vector to a string. More...
 
template<typename T >
std::string Mantid::Kernel::Strings::toString (const T &value)
 Convert a number to a string. More...
 
template<>
MANTID_KERNEL_DLL std::string Mantid::Kernel::Strings::toString (const UnitLabel &value)
 
MANTID_KERNEL_DLL std::string Mantid::Kernel::Strings::toUpper (const std::string &input)
 Converts string to all uppercase. More...
 
template<template< typename T, typename A > class V, typename T , typename A >
int Mantid::Kernel::Strings::writeFile (const std::string &Fname, const T &step, const V< T, A > &Y)
 Write a set of containers to a file. More...
 
template<template< typename T, typename A > class V, typename T , typename A >
int Mantid::Kernel::Strings::writeFile (const std::string &Fname, const V< T, A > &X, const V< T, A > &Y)
 Write out the three vectors into a file of type dc 9. More...
 
template<template< typename T, typename A > class V, typename T , typename A >
int Mantid::Kernel::Strings::writeFile (const std::string &Fname, const V< T, A > &X, const V< T, A > &Y, const V< T, A > &Err)
 Write out the three container into a file with column free-formated data in the form : More...
 
MANTID_KERNEL_DLL void Mantid::Kernel::Strings::writeMCNPX (const std::string &Line, std::ostream &OX)
 Write file in standard MCNPX input form. More...