std::string helpers More...
#include <sstream>#include <iomanip>#include <cstdlib>#include <cmath>#include "string_manip.h"
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) |
std::string helpers
| 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
| 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 | |||
| ) |
Referenced by format_percent(), popt::option_imp< void >::post_process(), and report_image_error().
| string ltrim | ( | string const & | str, | |
| string const & | totrim | |||
| ) |
Referenced by symbol_name_storage::demangle(), and trim().
| 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 | |||
| ) |
Referenced by parse_filename(), popt::option_imp< vector< string > >::post_process(), and comma_list< T >::set().
| string split | ( | string & | s, | |
| char | c | |||
| ) |
| string trim | ( | string const & | str, | |
| string const & | totrim | |||
| ) |
References ltrim(), and rtrim().
Referenced by setup_regex().
1.6.1