thepeg is hosted by Hepforge, IPPP Durham
ThePEG  2.1.5
ThePEG::StringUtils Class Reference

The StringUtils class contains a few static utility functions for basic strings. More...

#include <StringUtils.h>

Public Types

typedef vector< string > StringVector
 A vector of strings.
 
typedef string::size_type pos_t
 Convenient typdef.
 

Static Public Member Functions

static StringVector split (string s, string ws=" \\)
 Return a vector of string containing the substrings of s, defined by the separating characters in ws (the ws characters are not included in the substrings.
 
static string car (string s, string ws=" \\)
 Return the first substring of s, defined by the separating characters in ws (the ws characters are not included in the substrings.
 
static string cdr (string s, string ws=" \\)
 Return s after removing the first substring, defined by the separating characters in ws (the ws characters are not included in the substrings.
 
static string stripws (string str)
 Return the string str stripped from leading and trailing white space.
 
static string dirname (string file)
 Return the directory path part (excluding the trailing slash) of the given filename, or an empty string if no directory path is included.
 
static string basename (string file)
 Return the base name of the given filename, removing the directory path if present.
 
static string remsuf (string file)
 Remove the trailing suffix from the given filename.
 
static string suffix (string file)
 Return the trailing suffix (without the dot) of the given filename.
 
static map< string, string > xmlAttributes (string tag, string line, string::size_type curr=0)
 Assuming the line contains a valid XML tag, scan the line for attributes belonging to this tag and return a map of name-value pairs. More...
 
static string typeName (const type_info &t)
 Try to return a human-readable class name given a type_info object. More...
 
static string replace (string original, string from, string to)
 Replace all occurences of the substring 'from' with the substring 'to' in the string 'original' and return the new string.
 

Static Public Attributes

static const pos_t end = string::npos
 Convenient alias for npos.
 

Detailed Description

The StringUtils class contains a few static utility functions for basic strings.

Definition at line 21 of file StringUtils.h.

Member Function Documentation

◆ typeName()

static string ThePEG::StringUtils::typeName ( const type_info &  t)
static

Try to return a human-readable class name given a type_info object.

Currently only works for simple classes compiled by g++.

◆ xmlAttributes()

static map<string,string> ThePEG::StringUtils::xmlAttributes ( string  tag,
string  line,
string::size_type  curr = 0 
)
static

Assuming the line contains a valid XML tag, scan the line for attributes belonging to this tag and return a map of name-value pairs.

Oprionally only look from position curr in the line.


The documentation for this class was generated from the following file: