string_manip.cpp File Reference

std::string helpers More...

#include <sstream>
#include <iomanip>
#include <cstdlib>
#include <cmath>
#include "string_manip.h"
Include dependency graph for string_manip.cpp:

Functions

string erase_to_last_of (string const &str, char ch)
string split (string &s, char c)
bool is_prefix (string const &s, string const &prefix)
vector< string > separate_token (string const &str, char sep)
string ltrim (string const &str, string const &totrim)
string rtrim (string const &str, string const &totrim)
string trim (string const &str, string const &totrim)
string const format_percent (double value, size_t int_width, size_t fract_width, bool showpos)
 format_percent - smart format of double percentage value
template<>
unsigned int op_lexical_cast< unsigned int, string > (string const &str)

Detailed Description

std::string helpers

Remarks:
Copyright 2002 OProfile authors
Read the file COPYING
Author:
Philippe Elie
John Levon

Function Documentation

string erase_to_last_of ( string const &  str,
char  ch 
)

Referenced by op_basename().

string const format_percent ( double  value,
size_t  int_width,
size_t  frac_width,
bool  showpos = false 
)

format_percent - smart format of double percentage value

Parameters:
value - the value
int_width - the maximum integer integer width default to 2
frac_width - the fractionnary width default to 4
showpos - show + sign for positive values

This formats a percentage into exactly the given width and returns it. If the integer part is larger than the given int_width, the returned string will be wider. The returned string is never shorter than (fract_with + int_width + 1)

References is_prefix().

bool is_prefix ( string const &  s,
string const &  prefix 
)
string ltrim ( string const &  str,
string const &  totrim 
)
template<>
unsigned int op_lexical_cast< unsigned int, string > ( string const &  str  )  [inline]
string rtrim ( string const &  str,
string const &  totrim 
)

Referenced by trim().

vector<string> separate_token ( string const &  str,
char  sep 
)
string split ( string &  s,
char  c 
)
string trim ( string const &  str,
string const &  totrim 
)

References ltrim(), and rtrim().

Referenced by setup_regex().


Generated on 29 Jul 2013 for oprofile by  doxygen 1.6.1