#include <sstream>
#include <iomanip>
#include <cstdlib>
#include <cmath>
#include "string_manip.h"
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) |
std::string helpers
Definition in file string_manip.cpp.
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().
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
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().
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().
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().
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().
vector<string> separate_token | ( | string const & | str, | |
char | sep | |||
) |
Definition at line 54 of file string_manip.cpp.
Referenced by parse_filename(), popt::option_imp< vector< string > >::post_process(), oprof_start::read_set_events(), separate_token_tests(), and comma_list< T >::set().
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().
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().