string_manip.cpp File Reference

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

Go to the source code of this file.

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)
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

Definition in file string_manip.cpp.


Function Documentation

string erase_to_last_of ( string const &  str,
char  ch 
)

Definition at line 23 of file string_manip.cpp.

Referenced by erase_to_last_of_tests(), and op_basename().

Here is the caller graph for this function:

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)

Definition at line 107 of file string_manip.cpp.

References is_prefix().

Referenced by format_percent_tests().

Here is the call graph for this function:

Here is the caller graph for this function:

bool is_prefix ( string const &  s,
string const &  prefix 
)

Definition at line 46 of file string_manip.cpp.

Referenced by format_percent(), is_prefix_tests(), popt::option_imp< void >::post_process(), oprof_start::read_set_events(), and report_image_error().

Here is the caller graph for this function:

string ltrim ( string const &  str,
string const &  totrim 
)

Definition at line 84 of file string_manip.cpp.

Referenced by symbol_name_storage::demangle(), ltrim_tests(), and trim().

Here is the caller graph for this function:

template<>
unsigned int op_lexical_cast< unsigned int, string > ( string const &  str  )  [inline]
string rtrim ( string const &  str,
string const &  totrim 
)

Definition at line 92 of file string_manip.cpp.

Referenced by rtrim_tests(), and trim().

Here is the caller graph for this function:

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

Definition at line 34 of file string_manip.cpp.

Referenced by oprof_start::read_set_events(), and split_tests().

Here is the caller graph for this function:

string trim ( string const &  str,
string const &  totrim 
)

Definition at line 100 of file string_manip.cpp.

References ltrim(), and rtrim().

Referenced by do_test(), setup_regex(), and trim_tests().

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on 8 Nov 2012 for Oprofile by  doxygen 1.6.1