Mantid
Loading...
Searching...
No Matches
Functions
Mantid::Kernel::Strings Namespace Reference

Holds support functions for strings. More...

Functions

MANTID_KERNEL_DLL int confirmStr (const std::string &S, const std::string &fullPhrase)
 determine if a character group exists in a string More...
 
template<typename T >
int convert (const char *A, T &out)
 Convert a char* into a number. More...
 
template<typename T >
int convert (const std::string &A, T &out)
 Convert a string into a number. More...
 
template<typename T >
int convPartNum (const std::string &A, T &out)
 Takes a character string and evaluates the first [typename T] object. More...
 
MANTID_KERNEL_DLL int endsWithInt (const std::string &word)
 Get an int from the end of a word. More...
 
MANTID_KERNEL_DLL std::istream & extractToEOL (std::istream &is, std::string &str)
 Extract a line from input stream, discarding any EOL characters encountered. More...
 
MANTID_KERNEL_DLL int extractWord (std::string &Line, const std::string &Word, const int cnt=4)
 Get a word from a string. More...
 
template<typename T >
MANTID_KERNEL_DLL int findComp (std::istream &, const boost::regex &, T &)
 Find a compmonent in a Regex in a file. More...
 
template<>
DLLExport int findComp (std::istream &fh, const boost::regex &Re, std::string &Out)
 Finds the start of the tally. More...
 
template<typename T >
int findComp (std::istream &fh, const boost::regex &Re, T &Out)
 Finds the start of the tally. More...
 
MANTID_KERNEL_DLL int findPattern (std::istream &, const boost::regex &, std::string &)
 Finds a pattern in a file. More...
 
MANTID_KERNEL_DLL std::string fullBlock (const std::string &A)
 strip pre/post spaces More...
 
MANTID_KERNEL_DLL std::string getLine (std::istream &fh)
 Get a line and strip comments Use only for a single call. More...
 
MANTID_KERNEL_DLL void getLine (std::istream &fh, std::string &Line)
 Get a line and strip comments Use within a loop. More...
 
MANTID_KERNEL_DLL int getPartLine (std::istream &fh, std::string &Out, std::string &Excess, const int spc=256)
 get a part of a long line More...
 
float getVAXnum (const float A)
 Convert a VAX number to x86 little eindien. More...
 
MANTID_KERNEL_DLL std::string getWord (std::istream &in, bool consumeEOL)
 Returns the next word in the stream. More...
 
MANTID_KERNEL_DLL int isEmpty (const std::string &A)
 Determines if a string is only spaces. More...
 
MANTID_KERNEL_DLL int isMember (const std::vector< std::string > &group, const std::string &candidate)
 checks if the candidate is the member of the group More...
 
template<typename ITERATOR_TYPE >
DLLExport std::string join (ITERATOR_TYPE begin, ITERATOR_TYPE end, const std::string &separator, typename std::enable_if<!(std::is_same< typename std::iterator_traits< ITERATOR_TYPE >::iterator_category, std::random_access_iterator_tag >::value)>::type *=nullptr)
 Join a set or vector of (something that turns into a string) together into one string, separated by a string. More...
 
template<typename ITERATOR_TYPE >
DLLExport std::string join (ITERATOR_TYPE begin, ITERATOR_TYPE end, const std::string &separator, typename std::enable_if<(std::is_same< typename std::iterator_traits< ITERATOR_TYPE >::iterator_category, std::random_access_iterator_tag >::value)>::type *=nullptr)
 Join a set or vector of (something that turns into a string) together into one string, separated by a string. More...
 
template<typename ITERATOR_TYPE >
DLLExport std::string joinCompress (ITERATOR_TYPE begin, ITERATOR_TYPE end, const std::string &separator=",", const std::string &listSeparator="-")
 Join a set or vector of (something that turns into a string) together into one string, separated by a separator, adjacent items that are precisely 1 away from each other will be compressed into a list syntax e.g. More...
 
MANTID_KERNEL_DLL std::string loadFile (const std::string &filename)
 Loads the entire contents of a text file into a string. More...
 
template<typename Integer >
std::vector< std::vector< Integer > > parseGroups (const std::string &str)
 Parses unsigned integer groups, e.g. More...
 
MANTID_KERNEL_DLL std::vector< int > 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 peekLine (std::istream &fh)
 Peek at a line without extracting it from the stream. More...
 
void 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 readToEndOfLine (std::istream &in, bool ConsumeEOL)
 Eat everything from the stream until the next EOL. More...
 
MANTID_KERNEL_DLL std::string removeSpace (const std::string &CLine)
 strip all spaces More...
 
MANTID_KERNEL_DLL std::string 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 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 section (char *cA, T &out)
 Convert and cut a char*. More...
 
template<typename T >
int section (std::string &A, T &out)
 Convert and cut a string. More...
 
template<typename T >
int sectionMCNPX (std::string &A, T &out)
 Convert and cut a string for MCNPX. More...
 
template<typename T >
int sectPartNum (std::string &A, T &out)
 Convert and cut a string. More...
 
template<typename T >
int 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 shorten (const std::string &input, const size_t max_length)
 Converts long strings into "start ... end". More...
 
template<typename ITERATOR_TYPE >
DLLExport std::string simpleJoin (ITERATOR_TYPE begin, ITERATOR_TYPE end, const std::string &separator)
 Join a set or vector of (something that turns into a string) together into one string, separated by a string. More...
 
MANTID_KERNEL_DLL bool skipLine (const std::string &line)
 Determines if a string starts with a #. More...
 
MANTID_KERNEL_DLL size_t 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 > splitToKeyValues (const std::string &input, const std::string &keyValSep="=", const std::string &listSep=",")
 Splits a string into key value pairs. More...
 
template<typename T >
MANTID_KERNEL_DLL int StrComp (const char *, const boost::regex &, T &, const int=0)
 Find if a pattern matches a string. More...
 
template<typename T >
int StrComp (const char *Text, const boost::regex &Re, T &Aout, const int compNum)
 Find the match in regular expression and places number in Aout. More...
 
template<typename T >
MANTID_KERNEL_DLL int StrComp (const std::string &, const boost::regex &, T &, const int=0)
 Find if a pattern matches. More...
 
template<typename T >
int StrComp (const std::string &Text, const boost::regex &Re, T &Aout, const int compNum)
 Find the match in regular expression and places number in Aout. More...
 
template<typename T >
int StrFullCut (std::string &, const boost::regex &, std::vector< T > &)
 Cut out the searched section and returns component. More...
 
template<typename T >
int StrFullCut (std::string &, const boost::regex &, T &, const int=-1)
 Cut out the searched section and returns component. More...
 
template<>
int StrFullCut (std::string &Text, const boost::regex &Re, std::vector< std::string > &Aout)
 Find the match, return the disected items: Then remove the whole of the match The regexpression must have one ( ) around the area to extract This is specialised for string and thus does not need a convert. More...
 
template<typename T >
int StrFullSplit (const char *, const boost::regex &, std::vector< T > &)
 Split a line searched parts. More...
 
template<typename T >
int StrFullSplit (const std::string &, const boost::regex &, std::vector< T > &)
 Split a line searched parts. More...
 
MANTID_KERNEL_DLL std::string strip (const std::string &A)
 strip pre/post spaces More...
 
MANTID_KERNEL_DLL void stripComment (std::string &A)
 strip trailling comments More...
 
std::string stripMultSpc (const std::string &Line)
 Removes the multiple spaces in the line. More...
 
MANTID_KERNEL_DLL int StrLook (const std::string &, const boost::regex &)
 Find is a pattern matches. More...
 
MANTID_KERNEL_DLL std::vector< std::string > StrParts (const std::string &Ln)
 Split tring into spc deliminated components. More...
 
MANTID_KERNEL_DLL std::vector< std::string > StrParts (std::string, const boost::regex &)
 Split a line into component parts. More...
 
template<typename T >
int StrSingleSplit (const char *, const boost::regex &, std::vector< T > &)
 Split a line searched parts. More...
 
template<typename T >
int StrSingleSplit (const std::string &, const boost::regex &, std::vector< T > &)
 Split a line searched parts. More...
 
template<>
int StrSingleSplit (const std::string &text, const boost::regex &Re, std::vector< std::string > &Aout)
 Find the match, return the disected items The regexpression must have ( ) around the area to extract. More...
 
MANTID_KERNEL_DLL std::string toLower (const std::string &input)
 Converts string to all lowercase. More...
 
template<typename T >
std::string toString (const std::set< T > &value)
 Convert a set to a string. More...
 
template<>
MANTID_KERNEL_DLL std::string toString (const std::vector< std::string > &value)
 Template overload for a vector of strings. More...
 
template<typename T >
std::string toString (const std::vector< T > &value)
 Convert a vector to a string. More...
 
template<typename T >
std::string toString (const T &value)
 Convert a number to a string. More...
 
template<>
MANTID_KERNEL_DLL std::string toString (const UnitLabel &value)
 
MANTID_KERNEL_DLL std::string toUpper (const std::string &input)
 Converts string to all uppercase. More...
 
template<template< typename T, typename A > class V, typename T , typename A >
int 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 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 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 writeMCNPX (const std::string &Line, std::ostream &OX)
 Write file in standard MCNPX input form. More...
 

Detailed Description

Holds support functions for strings.

Function Documentation

◆ confirmStr()

int Mantid::Kernel::Strings::confirmStr ( const std::string &  S,
const std::string &  fullPhrase 
)

determine if a character group exists in a string

Check to see if S is the same as the first part of a phrase.

(case insensitive)

Parameters
S:: string to check
fullPhrase:: complete phrase
Returns
1 on success

Definition at line 239 of file Strings.cpp.

◆ convert() [1/2]

template<typename T >
int Mantid::Kernel::Strings::convert ( const char *  A,
T &  out 
)

Convert a char* into a number.

Convert a string into a value.

Parameters
A:: string to pass
out:: value if found
Returns
0 on failure 1 on success

Definition at line 689 of file Strings.cpp.

References convert().

◆ convert() [2/2]

template<typename T >
int Mantid::Kernel::Strings::convert ( const std::string &  A,
T &  out 
)

Convert a string into a number.

Convert a string into a value.

Parameters
A:: string to pass
out:: value if found
Returns
0 on failure 1 on success

Definition at line 665 of file Strings.cpp.

References convert().

Referenced by Mantid::Algorithms::SetInstrumentParameter::addParameter(), Mantid::Algorithms::AddSampleLog::addSingleValueProperty(), Mantid::Algorithms::AddSampleLog::addTimeSeriesProperty(), convert(), Mantid::Algorithms::FilterEvents::copyNoneSplitLogs(), endsWithInt(), Mantid::Crystal::LoadIsawUB::exec(), Mantid::Crystal::SaveHKL::exec(), Mantid::Crystal::SaveIsawPeaks::exec(), Mantid::Crystal::SaveLauenorm::exec(), Mantid::Crystal::SetGoniometer::exec(), Mantid::DataHandling::LoadIsawDetCal::exec(), Mantid::DataHandling::SaveIsawDetCal::exec(), Mantid::Kernel::FacilityInfo::fillMultiFileLimit(), Mantid::Kernel::FacilityInfo::fillZeroPadding(), Mantid::Kernel::InstrumentInfo::fillZeroPadding(), findComp(), Mantid::API::WorkspaceHistory::findHistoryEntries(), Mantid::API::BoxController::fromXMLString(), Mantid::MDAlgorithms::ConvertToDetectorFaceMD::getBanks(), Mantid::API::ExperimentInfo::getRunNumber(), Mantid::Algorithms::ConvertToConstantL2::getRunProperty(), Mantid::Kernel::ConfigServiceImpl::getValue(), Mantid::Algorithms::groupnumber(), Mantid::API::WorkspaceGroup::isMultiperiod(), Mantid::MDAlgorithms::SlicingAlgorithm::makeAlignedDimensionFromString(), Mantid::MDAlgorithms::SlicingAlgorithm::makeBasisVectorFromString(), Mantid::DataHandling::LoadSpice2D::parseDetectorDimensions(), Mantid::DataHandling::LoadHFIRSANS::parseDetectorDimensions(), Mantid::DataHandling::LoadGroupMapFile::parseFile(), parseRange(), Mantid::Geometry::SurfaceFactory::processLine(), Mantid::Geometry::CSGObject::procPair(), Mantid::DataObjects::PeakColumn< T >::read(), Mantid::Crystal::LoadIsawPeaks::readHeader(), Mantid::Crystal::LoadIsawUB::readModulatedUB(), Mantid::Algorithms::DetectorEfficiencyCorUser::retrieveProperties(), Mantid::Geometry::Plane::setSurface(), StrComp(), StrFullCut(), StrFullSplit(), StrSingleSplit(), and Mantid::Algorithms::SetInstrumentParameter::validateInputs().

◆ convPartNum()

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.

The string is then erase upto the end of number. The diffierence between this and convert is that it allows trailing characters after the number.

Parameters
out:: place for output
A:: string to process
Return values
numberof char read on success
0on failure

Definition at line 639 of file Strings.cpp.

Referenced by Mantid::Geometry::CSGObject::cellStr(), Mantid::Geometry::Acomp::processIntersection(), Mantid::Geometry::CSGObject::procString(), and Mantid::Geometry::Algebra::setFunctionObjStr().

◆ endsWithInt()

int Mantid::Kernel::Strings::endsWithInt ( const std::string &  word)

Get an int from the end of a word.

If a word ends with a number representing a positive integer, return the value of that int.

Parameters
word:: string possibly ending in a number
Returns
the number, or -1 if it does not end in a number

Definition at line 210 of file Strings.cpp.

References convert().

Referenced by Mantid::DataObjects::Peak::setDetectorID().

◆ extractToEOL()

std::istream & Mantid::Kernel::Strings::extractToEOL ( std::istream &  is,
std::string &  str 
)

Extract a line from input stream, discarding any EOL characters encountered.

Extract a string until an EOL character is reached.

There are 3 scenarios that we need to deal with 1) Windows-style - CRLF ('\r\n'); 2) Unix-style

  • LF ('\n'); 3) Old MAC style - CR ('\r'). This function will give the string preceding any of these sequences
    Parameters
    is:: The input stream to read from
    str:: The output string to use to accumulate the line
    Returns
    A reference to the input stream

Definition at line 1137 of file Strings.cpp.

Referenced by Mantid::DataHandling::LoadTBL::confidence(), Mantid::DataHandling::LoadLog::countNumberColumns(), Mantid::Kernel::LogParser::createLogProperty(), Mantid::DataHandling::LoadTBL::exec(), Mantid::DataHandling::LoadLog::isOldDateTimeFormat(), Mantid::DataHandling::LoadLog::LoadSNSText(), Mantid::DataHandling::LoadLog::loadThreeColumnLogFile(), and Mantid::DataHandling::LoadLog::loadTwoColumnLogFile().

◆ extractWord()

int Mantid::Kernel::Strings::extractWord ( std::string &  Line,
const std::string &  Word,
const int  cnt 
)

Get a word from a string.

Checks that as least cnt letters of works is part of the string.

It is currently case sensitive. It removes the Word if found

Parameters
Line:: Line to process
Word:: Word to use
cnt:: Length of Word for significants [default =4]
Return values
1on success (and changed Line)
0on failure

Definition at line 186 of file Strings.cpp.

◆ findComp() [1/3]

template<typename T >
MANTID_KERNEL_DLL int Mantid::Kernel::Strings::findComp ( std::istream &  fh,
const boost::regex &  Re,
T &  Out 
)

Find a compmonent in a Regex in a file.

Find a compmonent in a Regex in a file.

Parameters
fh:: open file stream
Re:: regular expression to match
Out:: component in ( ) expression must be first.
Returns
count of line that matched (or zero on failure)

Definition at line 282 of file RegexStrings.cpp.

References convert().

◆ findComp() [2/3]

template<>
DLLExport int Mantid::Kernel::Strings::findComp ( std::istream &  fh,
const boost::regex &  Re,
std::string &  Out 
)

Finds the start of the tally.

Parameters
fh:: open file stream
Re:: regular expression to match
Out:: component in ( ) expression must be first.
Returns
count of line that matched (or zero on failure)

Definition at line 307 of file RegexStrings.cpp.

◆ findComp() [3/3]

template<typename T >
int Mantid::Kernel::Strings::findComp ( std::istream &  fh,
const boost::regex &  Re,
T &  Out 
)

Finds the start of the tally.

Find a compmonent in a Regex in a file.

Parameters
fh:: open file stream
Re:: regular expression to match
Out:: component in ( ) expression must be first.
Returns
count of line that matched (or zero on failure)

Definition at line 282 of file RegexStrings.cpp.

References convert().

◆ findPattern()

DLLExport int Mantid::Kernel::Strings::findPattern ( std::istream &  fh,
const boost::regex &  Re,
std::string &  Out 
)

Finds a pattern in a file.

Finds the start of the tally.

Parameters
fh:: open file stream
Re:: regular expression to match
Out:: string to place match
Returns
count of line that matched (or zero on failure)

Definition at line 259 of file RegexStrings.cpp.

◆ fullBlock()

std::string Mantid::Kernel::Strings::fullBlock ( const std::string &  A)

strip pre/post spaces

Returns the string from the first non-space to the last non-space.

Parameters
A:: string to process
Returns
shortened string

Definition at line 389 of file Strings.cpp.

References strip().

◆ getLine() [1/2]

std::string Mantid::Kernel::Strings::getLine ( std::istream &  fh)

Get a line and strip comments Use only for a single call.

Reads a line from the stream of max length spc.

Trailing comments are removed. (with # or ! character)

Parameters
fh:: already open file handle
Returns
String read.

Definition at line 319 of file Strings.cpp.

References getLine().

Referenced by getLine(), Mantid::DataHandling::PDLoadCharacterizations::readCharInfo(), Mantid::DataHandling::PDLoadCharacterizations::readExpIni(), Mantid::DataHandling::PDLoadCharacterizations::readFocusInfo(), Mantid::DataHandling::PDLoadCharacterizations::readVersion0(), and Mantid::DataHandling::PDLoadCharacterizations::readVersion1().

◆ getLine() [2/2]

void Mantid::Kernel::Strings::getLine ( std::istream &  fh,
std::string &  Line 
)

Get a line and strip comments Use within a loop.

Reads a line from the stream of max length spc.

Trailing comments are removed. (with # or ! character)

Parameters
fh:: already open file handle
Line:: string read

Definition at line 332 of file Strings.cpp.

◆ getPartLine()

int Mantid::Kernel::Strings::getPartLine ( std::istream &  fh,
std::string &  Out,
std::string &  Excess,
const int  spc 
)

get a part of a long line

Gets a line and determine if there is addition component to add in the case of a very long line.

Parameters
fh:: input stream to get line
Out:: string up to last 'tab' or ' '
Excess:: string after 'tab or ' '
spc:: number of char to try to read
Return values
1:: more line to be found
-1:: Error with file
0:: line finished.

Definition at line 262 of file Strings.cpp.

◆ getVAXnum()

float Mantid::Kernel::Strings::getVAXnum ( const float  A)

Convert a VAX number to x86 little eindien.

Converts a vax number into a standard unix number.

Parameters
A:: float number as read from a VAX file
Returns
float A in IEEE little eindian format

Definition at line 491 of file Strings.cpp.

◆ getWord()

std::string Mantid::Kernel::Strings::getWord ( std::istream &  in,
bool  consumeEOL 
)

Returns the next word in the stream.

Get a word from a line and strips spaces.

Parameters
in:: stream input
consumeEOL:: set to true to remove the new lines at the end of the line
Returns
a string with the word read in

Definition at line 900 of file Strings.cpp.

References getWord().

Referenced by Mantid::Crystal::LoadIsawUB::exec(), Mantid::Crystal::SaveHKL::exec(), getWord(), Mantid::Crystal::LoadIsawUB::readModulatedUB(), and readToEndOfLine().

◆ isEmpty()

int Mantid::Kernel::Strings::isEmpty ( const std::string &  A)

Determines if a string is only spaces.

Parameters
A:: string to check
Returns
1 on an empty string , 0 on failure

Definition at line 359 of file Strings.cpp.

Referenced by writeMCNPX().

◆ isMember()

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

Function checks if the candidate is the member of the group.

Parameters
group:: vector of string to check
candidate:: the string which has to be checked against the group
Returns
:: number of the candidate in the input vector of strings if the candidate belongs to the group or -1 if it does not. Returns the number of the first maching entry in the group if there are duplicated entries in the group

Definition at line 1050 of file Strings.cpp.

Referenced by Mantid::MDAlgorithms::UnitsConversionHelper::analyzeUnitsConversion(), Mantid::MDAlgorithms::MDWSTransform::getQScaling(), and Mantid::MDAlgorithms::MDWSTransform::getTargetFrame().

◆ join() [1/2]

template<typename ITERATOR_TYPE >
DLLExport std::string Mantid::Kernel::Strings::join ( ITERATOR_TYPE  begin,
ITERATOR_TYPE  end,
const std::string &  separator,
typename std::enable_if<!(std::is_same< typename std::iterator_traits< ITERATOR_TYPE >::iterator_category, std::random_access_iterator_tag >::value)>::type *  = nullptr 
)

Join a set or vector of (something that turns into a string) together into one string, separated by a string.

Returns an empty string if the range is null. Does not add the separator after the LAST item.

For example, join a vector of strings with commas with: out = join(v.begin(), v.end(), ", ");

This version is used for random access iterators (e.g. map, set), and it calls simpleJoin().

Parameters
begin:: iterator at the start
end:: iterator at the end
separator:: string to append.
Returns

Definition at line 84 of file Strings.h.

References join(), and simpleJoin().

Referenced by Mantid::Kernel::ConfigServiceImpl::appendDataSearchDir(), Mantid::ICat::ICat4Catalog::buildSearchQuery(), join(), parseRange(), Mantid::CurveFitting::Functions::CrystalFieldControl::parseStringListAttribute(), toString(), Mantid::API::BoxController::toXMLString(), Mantid::API::IFunction::writeToString(), and Mantid::CurveFitting::Functions::CrystalFieldSpectrum::writeToString().

◆ join() [2/2]

template<typename ITERATOR_TYPE >
DLLExport std::string Mantid::Kernel::Strings::join ( ITERATOR_TYPE  begin,
ITERATOR_TYPE  end,
const std::string &  separator,
typename std::enable_if<(std::is_same< typename std::iterator_traits< ITERATOR_TYPE >::iterator_category, std::random_access_iterator_tag >::value)>::type *  = nullptr 
)

Join a set or vector of (something that turns into a string) together into one string, separated by a string.

Returns an empty string if the range is null. Does not add the separator after the LAST item.

For example, join a vector of strings with commas with: out = join(v.begin(), v.end(), ", ");

This is a faster threaded version of the join() function above. It is used only if the iterators are not random access (e.g. vector), as it needs to be able to determine the distance between begin and end. It reverts to calling simpleJoin() if the input array is small.

Parameters
begin:: iterator at the start
end:: iterator at the end
separator:: string to append.
Returns

Definition at line 111 of file Strings.h.

References join(), PARALLEL_GET_MAX_THREADS, PARALLEL_NUMBER_OF_THREADS, PARALLEL_THREAD_NUMBER, and simpleJoin().

◆ joinCompress()

template<typename ITERATOR_TYPE >
DLLExport std::string Mantid::Kernel::Strings::joinCompress ( ITERATOR_TYPE  begin,
ITERATOR_TYPE  end,
const std::string &  separator = ",",
const std::string &  listSeparator = "-" 
)

Join a set or vector of (something that turns into a string) together into one string, separated by a separator, adjacent items that are precisely 1 away from each other will be compressed into a list syntax e.g.

1-5. Returns an empty string if the range is null. Does not add the separator after the LAST item.

For example, join a vector of strings with commas with: out = join(v.begin(), v.end(), ", ");

Parameters
begin:: iterator at the start
end:: iterator at the end
separator:: string to append between items.
listSeparator:: string to append between list items.
Returns
A string with contiguous values compressed using the list syntax

Definition at line 196 of file Strings.h.

◆ loadFile()

std::string Mantid::Kernel::Strings::loadFile ( const std::string &  filename)

◆ parseGroups()

template<typename Integer >
std::vector< std::vector< Integer > > Mantid::Kernel::Strings::parseGroups ( const std::string &  str)

Parses unsigned integer groups, e.g.

"1+2,4-7,9,11" to a nested vector structure.

Definition at line 355 of file Strings.h.

References Mantid::Kernel::StringTokenizer::TOK_IGNORE_EMPTY, and Mantid::Kernel::StringTokenizer::TOK_TRIM.

◆ parseRange()

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.

"1,4-9,54-111,3,10", to the vector containing all the elements within the range

"1,4-9,54-111,3,10", to the vector containing all the elements within the range.

Parameters
strString to parse
elemSepString with characters used to separate elements (',')
rangeSepString with characters used to separate range start and end ('-')
Returns
A vector with all the elements from the range

Definition at line 1071 of file Strings.cpp.

References convert(), and join().

Referenced by Mantid::DataHandling::LoadGroupMapFile::parseFile(), Mantid::DataHandling::LoadGroupXMLFile::parseXML(), and Mantid::API::Grouping::toTable().

◆ peekLine()

std::string Mantid::Kernel::Strings::peekLine ( std::istream &  fh)

Peek at a line without extracting it from the stream.

Definition at line 344 of file Strings.cpp.

References strip().

Referenced by Mantid::DataHandling::LoadAscii::peekLine(), and Mantid::DataHandling::PDLoadCharacterizations::readFocusInfo().

◆ printHex()

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)

Parameters
OFS:: Output stream
n:: Integer to convert
Todo:
Change this to a stream operator

Definition at line 138 of file Strings.cpp.

References n.

◆ readToEndOfLine()

void Mantid::Kernel::Strings::readToEndOfLine ( std::istream &  in,
bool  ConsumeEOL 
)

Eat everything from the stream until the next EOL.

Read up to the eol.

Parameters
in:: stream input
ConsumeEOL:: set to true to remove the new lines at the end of the line

Definition at line 951 of file Strings.cpp.

References getWord(), and readToEndOfLine().

Referenced by Mantid::Crystal::LoadIsawUB::exec(), Mantid::Crystal::SaveHKL::exec(), Mantid::Crystal::LoadIsawUB::readModulatedUB(), and readToEndOfLine().

◆ removeSpace()

std::string Mantid::Kernel::Strings::removeSpace ( const std::string &  CLine)

strip all spaces

Removes all spaces from a string except those with in the form '\ '.

Parameters
CLine:: Line to strip
Returns
String without space

Definition at line 300 of file Strings.cpp.

Referenced by Mantid::Algorithms::FilterEvents::createOutputWorkspacesSplitters().

◆ replace()

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.

Parameters
input:: input string
find_what:: will search for all occurences of this string
replace_with:: ... and replace them with this.
Returns
the modified string.

Definition at line 74 of file Strings.cpp.

Referenced by MantidQt::API::qtPluginPathFromCfg().

◆ replaceAll()

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.

Parameters
input:: The input string to perform the replacement on
charStr:: Each occurrence of ANY character in this string within the input string will be replaced by substitute
substitute:: A substitute string
Returns
A new string with the characters replaced

Definition at line 94 of file Strings.cpp.

Referenced by Mantid::DataHandling::CheckMantidVersion::cleanVersionTag(), and Mantid::Algorithms::PDDetermineCharacterizations::exec().

◆ section() [1/2]

template<typename T >
int Mantid::Kernel::Strings::section ( char *  cA,
T &  out 
)

Convert and cut a char*.

Takes a character string and evaluates the first [typename T] object.

The string is then filled with spaces upto the end of the [typename T] object

Parameters
out:: place for output
cA:: char array for input and output.
Returns
1 on success 0 on failure

Definition at line 553 of file Strings.cpp.

References section().

◆ section() [2/2]

template<typename T >
int Mantid::Kernel::Strings::section ( std::string &  A,
T &  out 
)

Convert and cut a string.

takes a character string and evaluates the first <T> object.

The string is then filled with spaces upto the end of the <T> object

Parameters
out:: place for output
A:: string for input and output.
Returns
1 on success 0 on failure

Definition at line 573 of file Strings.cpp.

Referenced by section(), Mantid::Geometry::Cone::setSurface(), Mantid::Geometry::Cylinder::setSurface(), Mantid::Geometry::General::setSurface(), Mantid::Geometry::Plane::setSurface(), Mantid::Geometry::Sphere::setSurface(), Mantid::Geometry::Torus::setSurface(), and setValues().

◆ sectionMCNPX()

template<typename T >
int Mantid::Kernel::Strings::sectionMCNPX ( std::string &  A,
T &  out 
)

Convert and cut a string for MCNPX.

Takes a character string and evaluates the first [T] object.

The string is then filled with spaces upto the end of the [T] object. This version deals with MCNPX numbers. Those are numbers that are crushed together like

  • 5.4938e+04-3.32923e-6
    Parameters
    out:: place for output
    A:: string for input and output.
    Returns
    1 on success 0 on failure

Definition at line 603 of file Strings.cpp.

◆ sectPartNum()

template<typename T >
int Mantid::Kernel::Strings::sectPartNum ( std::string &  A,
T &  out 
)

Convert and cut a string.

Takes a character string and evaluates the first [typename T] object.

The string is then erase upt to the end of number. The diffierence between this and section is that it allows trailing characters after the number.

Parameters
out:: place for output
A:: string to process
Returns
1 on success 0 on failure

Definition at line 527 of file Strings.cpp.

◆ setValues()

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.

Note to avoid the dependency on crossSort this needs to be call IN ORDER

Parameters
Line:: string to read
Index:: Indexes to read
Out:: OutValues [unchanged if not read]
Return values
0:: success
-veon failure.

Definition at line 844 of file Strings.cpp.

References section(), and value.

◆ shorten()

std::string Mantid::Kernel::Strings::shorten ( const std::string &  input,
const size_t  max_length 
)

Converts long strings into "start ... end".

Return a string shortened with the center replace by " ... " If the string is already short enough then the original string will be returned.

If the max length or input string length is smaller than the ellipsis, the input will be returned.

Parameters
input:: input string
max_length:: The maximum length of the return string (0 = return full string)
Returns
the modified string.

Definition at line 54 of file Strings.cpp.

Referenced by Mantid::Kernel::PropertyHistory::printSelf(), and Mantid::Kernel::Property::valueAsPrettyStr().

◆ simpleJoin()

template<typename ITERATOR_TYPE >
DLLExport std::string Mantid::Kernel::Strings::simpleJoin ( ITERATOR_TYPE  begin,
ITERATOR_TYPE  end,
const std::string &  separator 
)

Join a set or vector of (something that turns into a string) together into one string, separated by a string.

Returns an empty string if the range is null. Does not add the separator after the LAST item.

For example, join a vector of strings with commas with: out = join(v.begin(), v.end(), ", ");

This is a simple default version that works in all cases but is potentially slow.

Parameters
begin:: iterator at the start
end:: iterator at the end
separator:: string to append.
Returns

Definition at line 53 of file Strings.h.

Referenced by join().

◆ skipLine()

bool Mantid::Kernel::Strings::skipLine ( const std::string &  line)

Determines if a string starts with a #.

Return true if the line is to be skipped (starts with #).

Parameters
line:: The line to be checked
Returns
True if the line should be skipped

Definition at line 408 of file Strings.cpp.

Referenced by Mantid::DataHandling::LoadAscii::skipLine().

◆ split_path()

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 *‍/

Function parses a path, placed into input string "path" and returns vector of the folders contributed into the path.

Parameters
path:: the string containing input path, found in path string, if they are separated by \ or / symbols. Treats special symbols, if defined in the input string as path-es returns 0 for empty input string
path_components:: holder for the individual folders in the path used to generate path in hdf file, so the resulting path has to obey hdf constrains;

Definition at line 970 of file Strings.cpp.

◆ splitToKeyValues()

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.

Splits a string into key value pairs and returns them as a map.

Whitespace between separators is ignored

Parameters
input:: The string containing the key/values
keyValSep:: The separator that splits a key and value [default: "="]
listSep:: The separator that splits elements of the list [default: ","]
Returns
A map of keys->values

Definition at line 469 of file Strings.cpp.

References Mantid::Kernel::StringTokenizer::count(), Mantid::Kernel::StringTokenizer::TOK_IGNORE_EMPTY, and Mantid::Kernel::StringTokenizer::TOK_TRIM.

◆ StrComp() [1/4]

template<typename T >
MANTID_KERNEL_DLL int Mantid::Kernel::Strings::StrComp ( const char *  Text,
const boost::regex &  Re,
T &  Aout,
const int  compNum 
)

Find if a pattern matches a string.

Find if a pattern matches a string.

Parameters
Text:: string to search
Re:: regular expression to use
Aout:: Place to put Unit found
compNum:: item to extract [0:N-1]
Returns
0 on failure and 1 on success

Definition at line 48 of file RegexStrings.cpp.

References StrComp().

Referenced by StrComp().

◆ StrComp() [2/4]

template<typename T >
int Mantid::Kernel::Strings::StrComp ( const char *  Text,
const boost::regex &  Re,
T &  Aout,
const int  compNum 
)

Find the match in regular expression and places number in Aout.

Find if a pattern matches a string.

Parameters
Text:: string to search
Re:: regular expression to use
Aout:: Place to put Unit found
compNum:: item to extract [0:N-1]
Returns
0 on failure and 1 on success

Definition at line 48 of file RegexStrings.cpp.

References StrComp().

Referenced by StrComp().

◆ StrComp() [3/4]

template<typename T >
MANTID_KERNEL_DLL int Mantid::Kernel::Strings::StrComp ( const std::string &  Text,
const boost::regex &  Re,
T &  Aout,
const int  compNum 
)

Find if a pattern matches.

Find if a pattern matches.

Parameters
Text:: string to search
Re:: regular expression to use
Aout:: Place to put Unit found
compNum:: item to extract [0:N-1]
Returns
0 on failure and 1 on success

Definition at line 28 of file RegexStrings.cpp.

References convert(), and count.

◆ StrComp() [4/4]

template<typename T >
int Mantid::Kernel::Strings::StrComp ( const std::string &  Text,
const boost::regex &  Re,
T &  Aout,
const int  compNum 
)

Find the match in regular expression and places number in Aout.

Find if a pattern matches.

Parameters
Text:: string to search
Re:: regular expression to use
Aout:: Place to put Unit found
compNum:: item to extract [0:N-1]
Returns
0 on failure and 1 on success

Definition at line 28 of file RegexStrings.cpp.

References convert(), and count.

◆ StrFullCut() [1/3]

template<typename T >
int Mantid::Kernel::Strings::StrFullCut ( std::string &  Text,
const boost::regex &  Re,
std::vector< T > &  Aout 
)

Cut out the searched section and returns component.

Find the match, return the disected items: Then remove the whole of the match The regexpression must have one ( ) around the area to extract.

Parameters
Text:: string to split, is returned with the string after the find (if successful).
Re:: regular expression to use.
Aout:: Values to extract
Return values
0:: failed to match the string or there were no parts to match.
1:: success

Definition at line 121 of file RegexStrings.cpp.

References convert(), index, and tmp.

◆ StrFullCut() [2/3]

template<typename T >
int Mantid::Kernel::Strings::StrFullCut ( std::string &  Text,
const boost::regex &  Re,
T &  Aout,
const int  compNum 
)

Cut out the searched section and returns component.

Find the match, return the disected items: Then remove the whole of the match The regexpression must have one ( ) around the area to extract.

Parameters
Text:: string to split, is returned with the string after the find (if successful).
Re:: regular expression to use.
Aout:: Value to extract
compNum:: Index of matches [0->N-1] (-1 :: whole match)
Return values
0:: failed to match the string or there were no parts to match.
1:: success

Definition at line 93 of file RegexStrings.cpp.

References convert().

◆ StrFullCut() [3/3]

template<>
int Mantid::Kernel::Strings::StrFullCut ( std::string &  Text,
const boost::regex &  Re,
std::vector< std::string > &  Aout 
)

Find the match, return the disected items: Then remove the whole of the match The regexpression must have one ( ) around the area to extract This is specialised for string and thus does not need a convert.

Parameters
Text:: string to split, is returned with the string after the find (if successful).
Re:: regular expression to use.
Aout:: Values to extract
Return values
0:: failed to match the string or there were no parts to match.
1:: success

Definition at line 160 of file RegexStrings.cpp.

References index.

◆ StrFullSplit() [1/2]

template<typename T >
int Mantid::Kernel::Strings::StrFullSplit ( const char *  ,
const boost::regex &  ,
std::vector< T > &   
)

Split a line searched parts.

◆ StrFullSplit() [2/2]

template<typename T >
int Mantid::Kernel::Strings::StrFullSplit ( const std::string &  text,
const boost::regex &  Re,
std::vector< T > &  Aout 
)

Split a line searched parts.

Find the match, return the disected items The rege xpression must have ( ) around the area to extract.

The function appends the results onto Aout.

Parameters
text:: string to split, is returned with the string after the find (if successful).
Re:: regular expression to use.
Aout:: vector to add components to.
Return values
0:: failed to match the string or there were no parts to match.
Number:: number of components added to Aout.

Definition at line 191 of file RegexStrings.cpp.

References convert(), index, and tmp.

◆ strip()

std::string Mantid::Kernel::Strings::strip ( const std::string &  A)

◆ stripComment()

void Mantid::Kernel::Strings::stripComment ( std::string &  A)

strip trailling comments

removes the string after the comment type of '$ ' or '!' or '# '

Parameters
A:: String to process

Definition at line 370 of file Strings.cpp.

◆ stripMultSpc()

std::string Mantid::Kernel::Strings::stripMultSpc ( const std::string &  Line)

Removes the multiple spaces in the line.

Parameters
Line:: Line to process
Returns
String with single space components

Definition at line 154 of file Strings.cpp.

◆ StrLook()

int Mantid::Kernel::Strings::StrLook ( const std::string &  Text,
const boost::regex &  Re 
)

Find is a pattern matches.

Find the match in regular expression and return 1 if good match.

Parameters
Text:: string to match
Re:: regular expression to use
Returns
0 on failure and 1 on success

Definition at line 58 of file RegexStrings.cpp.

Referenced by Mantid::Geometry::CSGObject::setObject().

◆ StrParts() [1/2]

std::vector< std::string > Mantid::Kernel::Strings::StrParts ( const std::string &  Ln)

Split tring into spc deliminated components.

Splits the sting into parts that are space delminated.

Parameters
Ln:: line component to strip
Returns
vector of components

Definition at line 454 of file Strings.cpp.

References Mantid::Kernel::StringTokenizer::asVector(), Mantid::Kernel::StringTokenizer::TOK_IGNORE_EMPTY, and Mantid::Kernel::StringTokenizer::TOK_TRIM.

◆ StrParts() [2/2]

std::vector< std::string > Mantid::Kernel::Strings::StrParts ( std::string  Sdx,
const boost::regex &  Re 
)

Split a line into component parts.

Find the match, return the disected items.

Note it is complementary to support.h StrParts(Sdx)

Parameters
Sdx:: Input string (note implicit copy since altered)
Re:: Regular expression for separator component
Returns
vector of string components

Definition at line 74 of file RegexStrings.cpp.

◆ StrSingleSplit() [1/3]

template<typename T >
int Mantid::Kernel::Strings::StrSingleSplit ( const char *  ,
const boost::regex &  ,
std::vector< T > &   
)

Split a line searched parts.

◆ StrSingleSplit() [2/3]

template<typename T >
int Mantid::Kernel::Strings::StrSingleSplit ( const std::string &  text,
const boost::regex &  Re,
std::vector< T > &  Aout 
)

Split a line searched parts.

Find the match, return the disected items The regexpression must have ( ) around the area to extract.

The function appends the results onto Aout.

Parameters
text:: string to split, is returned with the string after the find (if successful).
Re:: regular expression to use.
Aout:: vector to add components to.
Return values
0:: failed to match the string or there were no parts to match.
Number:: number of components added to Aout.

Definition at line 215 of file RegexStrings.cpp.

References convert(), index, and tmp.

◆ StrSingleSplit() [3/3]

template<>
int Mantid::Kernel::Strings::StrSingleSplit ( const std::string &  text,
const boost::regex &  Re,
std::vector< std::string > &  Aout 
)

Find the match, return the disected items The regexpression must have ( ) around the area to extract.

The function appends the results onto Aout.

  • Specialised to avoid convert for std::string
    Parameters
    text:: string to split, is returned with the string after the find (if successful).
    Re:: regular expression to use.
    Aout:: vector to add components to.
    Return values
    0:: failed to match the string or there were no parts to match.
    Number:: number of components added to Aout.

Definition at line 241 of file RegexStrings.cpp.

References index.

◆ toLower()

MANTID_KERNEL_DLL std::string Mantid::Kernel::Strings::toLower ( const std::string &  input)

Converts string to all lowercase.

Convert all characters in string to lowercase.

Definition at line 116 of file Strings.cpp.

Referenced by Mantid::Kernel::FileDescriptor::initialize(), and Mantid::API::FileProperty::setLoadProperty().

◆ toString() [1/5]

template<typename T >
std::string Mantid::Kernel::Strings::toString ( const std::set< T > &  value)

Convert a set to a string.

Definition at line 741 of file Strings.cpp.

References toString(), and value.

◆ toString() [2/5]

template<>
MANTID_KERNEL_DLL std::string Mantid::Kernel::Strings::toString ( const std::vector< std::string > &  value)

Template overload for a vector of strings.

Parameters
value:: A value to convert to a string.
Returns
:: A string with comma separated items of the value vector.

Definition at line 750 of file Strings.cpp.

References join(), toString(), and value.

◆ toString() [3/5]

template<typename T >
std::string Mantid::Kernel::Strings::toString ( const std::vector< T > &  value)

Convert a vector to a string.

This assumes that the vector is sorted.

Parameters
value:: templated value (only works for integer types) to convert.
Returns
A reduced string representation.

Definition at line 715 of file Strings.cpp.

References toString(), and value.

◆ toString() [4/5]

template<typename T >
std::string Mantid::Kernel::Strings::toString ( const T &  value)

Convert a number to a string.

Convert a number or other value to a string.

Parameters
value:: templated value (e.g. a double) to convert
Returns
a string

Definition at line 703 of file Strings.cpp.

References toString(), and value.

Referenced by Mantid::ICat::ICat4Catalog::buildSearchQuery(), Mantid::MDAlgorithms::CompareMDWorkspaces::compareMDGeometry(), Mantid::MDAlgorithms::CompareMDWorkspaces::compareMDHistoWorkspaces(), Mantid::DataHandling::LoadTOFRawNexus::countPixels(), Mantid::MDAlgorithms::MergeMD::createOutputWorkspace(), Mantid::MDAlgorithms::SaveMD::doSaveHisto(), Mantid::MDAlgorithms::SaveMD2::doSaveHisto(), Mantid::Algorithms::AddLogDerivative::exec(), Mantid::Crystal::MaskPeaksWorkspace::exec(), Mantid::Crystal::PeakIntensityVsRadius::exec(), Mantid::Crystal::SetGoniometer::exec(), Mantid::MDAlgorithms::SaveZODS::exec(), Mantid::MDAlgorithms::ConvertToDetectorFaceMD::getBanks(), Mantid::MDAlgorithms::MDNorm::getBinParameters(), Mantid::MDAlgorithms::QueryMDWorkspace::getBoxData(), MantidQt::MantidWidgets::FunctionModelSpectra::getString(), Mantid::API::Grouping::Grouping(), Mantid::MDAlgorithms::MDNorm::init(), Mantid::MDAlgorithms::MDNormDirectSC::init(), Mantid::MDAlgorithms::MDNormSCD::init(), Mantid::API::BoxControllerSettingsAlgorithm::initBoxControllerProps(), Mantid::MDAlgorithms::SlicingAlgorithm::initSlicingProps(), Mantid::DataObjects::MDBoxFlatTree::loadExperimentInfos(), Mantid::API::WorkspaceHistory::loadNestedHistory(), Mantid::API::Sample::loadNexus(), Mantid::Geometry::Goniometer::loadNexus(), Mantid::MDAlgorithms::SlicingAlgorithm::makeBasisVectorFromString(), Mantid::Algorithms::AddLogDerivative::makeDerivative(), Mantid::MDAlgorithms::SlicingAlgorithm::processGeneralTransformProperties(), Mantid::API::Algorithm::processGroups(), Mantid::API::MultiPeriodGroupWorker::processGroups(), Mantid::DataObjects::MDBoxFlatTree::saveExperimentInfos(), Mantid::API::Sample::saveNexus(), Mantid::Geometry::Goniometer::saveNexus(), Mantid::API::BoxControllerSettingsAlgorithm::setBoxController(), toString(), Mantid::MDAlgorithms::MDNorm::validateInputs(), and Mantid::MDAlgorithms::versus().

◆ toString() [5/5]

template<>
MANTID_KERNEL_DLL std::string Mantid::Kernel::Strings::toString ( const UnitLabel value)

Definition at line 745 of file Strings.cpp.

References toString(), and value.

◆ toUpper()

MANTID_KERNEL_DLL std::string Mantid::Kernel::Strings::toUpper ( const std::string &  input)

Converts string to all uppercase.

Convert all characters in string to uppercase.

Definition at line 124 of file Strings.cpp.

Referenced by Mantid::API::FileProperty::setLoadProperty().

◆ writeFile() [1/3]

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.

Write out the three vectors into a file of type dc 9.

Parameters
step:: parameter to control x-step (starts from zero)
Y:: Y column
Fname:: Name of the file
Returns
0 on success and -ve on failure

Definition at line 763 of file Strings.cpp.

References writeFile(), Mantid::Geometry::X, and Mantid::Geometry::Y.

Referenced by writeFile().

◆ writeFile() [2/3]

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.

Parameters
X:: X column
Y:: Y column
Fname:: Name of the file
Returns
0 on success and -ve on failure

Definition at line 781 of file Strings.cpp.

References writeFile(), Mantid::Geometry::X, and Mantid::Geometry::Y.

◆ writeFile() [3/3]

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 :

  • X Y Err If Err does not exist (or is short) 0.0 is substituted.
    Parameters
    X:: X column
    Y:: Y column
    Err:: Err column
    Fname:: Name of the file
    Returns
    0 on success and -ve on failure

Definition at line 799 of file Strings.cpp.

References Mantid::Geometry::X, and Mantid::Geometry::Y.

◆ writeMCNPX()

void Mantid::Kernel::Strings::writeMCNPX ( const std::string &  Line,
std::ostream &  OX 
)

Write file in standard MCNPX input form.

Write out the line in the limited form for MCNPX ie initial line from 0->72 after that 8 to 72 (split on a space or comma)

Parameters
Line:: full MCNPX line
OX:: ostream to write to

Definition at line 421 of file Strings.cpp.

References isEmpty(), and Mantid::Geometry::X.

Referenced by Mantid::Geometry::CSGObject::write(), Mantid::Geometry::Cone::write(), Mantid::Geometry::Cylinder::write(), Mantid::Geometry::Plane::write(), Mantid::Geometry::Quadratic::write(), Mantid::Geometry::Sphere::write(), and Mantid::Geometry::Torus::write().