![]() |
Rosetta Utilities
2015.25
|
Some std::string helper functions. More...
#include <platform/types.hh>#include <utility/numbers.hh>#include <utility/exit.hh>#include <utility/excn/Exceptions.hh>#include <utility/file/FileName.hh>#include <utility/io/izstream.hh>#include <utility/string_util.hh>#include <utility/vector1.hh>#include <ObjexxFCL/string.functions.hh>#include <locale>#include <fstream>#include <iostream>#include <sstream>#include <string>#include <cmath>#include <boost/uuid/sha1.hpp>Namespaces | |
| utility | |
| unresizable vector whose size is known at compile time, which may be allocated on the stack, and which indexes from 1. | |
Functions | |
| void | utility::ReadFromFileOrDie (const std::string &filename, std::string *contents) |
| Reads the contents of <filename> into <contents>, preserving newline characters. Aborts if an error is encoutered. More... | |
| utility::vector1< std::string > | utility::split (const std::string &s) |
| split given std::string using ' ' symbol. More... | |
| utility::vector1< std::string > | utility::split_whitespace (const std::string &s) |
| split given std::string using whitespace as a separator. Unlike string_split_multi_delim(), any group of mixed whitespace counts only as a single seperator. More... | |
| std::string | utility::join (utility::vector1< std::string > const &s, std::string const &connector) |
| combine strings with anything More... | |
| std::string | utility::join (std::vector< std::string > const &s, std::string const &connector) |
| combine strings with anything More... | |
| std::string | utility::join (std::string const &string_w_spaces, std::string const &connector) |
| join space separations in a string with a connector such as '_' More... | |
| std::list< std::string > | utility::split_to_list (const std::string &s) |
| split given std::string using ' ' symbol. More... | |
| std::set< std::string > | utility::split_to_set (std::string const &s) |
| split given std::string to a set using ' ' symbol. More... | |
| utility::vector1< std::string > | utility::string_split (std::string const &in, char splitchar) |
| utility::vector1< std::string > | utility::string_split_simple (std::string const &in, char splitchar= ' ') |
| split to vector1< std::string > using arbitrary split character, but no empty strings (closer to python string::split) More... | |
| utility::vector1< std::string > | utility::string_split_multi_delim (std::string const &in, std::string splitchars) |
| float | utility::string2float (std::string st) |
| convert a string to a float, returns -1 on failure More... | |
| int | utility::string2int (std::string st) |
| convert a string to an int, returns -1 on failure More... | |
| platform::Size | utility::string2Size (std::string st) |
| convert a string to a Size, returns numeric::get_undefined_size() on failure More... | |
| platform::Real | utility::string2Real (std::string st) |
| convert a string to a Real, returns numeric::get_undefined_real() on failure More... | |
| void | utility::string2uint (const std::string &x, unsigned int *y) |
| bool | utility::trimmed_compare (std::string const &s1, std::string const &s2) |
| compares two strings ignoring leading and trailing spaces More... | |
| bool | utility::startswith (std::string const &haystack, std::string const &needle) |
| True iff haystack starts with needle. More... | |
| bool | utility::endswith (std::string const &haystack, std::string const &needle) |
| True iff haystack ends with needle. More... | |
| void | utility::slurp (std::istream &in, std::string &out) |
| void | utility::trim (std::string &s, const std::string &drop) |
| std::string | utility::trim (std::string const &s, std::string const &drop=" ") |
| create a new string that drops all the unwanted substrings of the original string. More... | |
| void | utility::add_spaces_left_align (std::string &st, std::size_t const newlen) |
| adds spaces to a left aligned string until a given length is reached More... | |
| void | utility::add_spaces_right_align (std::string &st, std::size_t const newlen) |
| adds spaces to a right aligned string until a given length is reached More... | |
| bool | utility::is_string_numeric (std::string const &input) |
| std::string | utility::file_contents (std::string const &file_name) |
| Read the entire contents of a file into a string. All end-of-line characters are replaced by "\n". Throws a utility::excn::EXCN_msg_exception if the file cannot be opened. More... | |
| std::string | utility::file_basename (const std::string &full_path) |
| std::string | utility::filename (const std::string &path) |
| std::string | utility::pathname (const std::string &path) |
| std::string | utility::replace_environment_variables (std::string input) |
| find all environment variables with the form ${VARIABLE} and replace with the contents of that environment variable. if the environment variable does not exist, return string::npos More... | |
| std::string | utility::string_to_sha1 (std::string const &input_string) |
| std::string | utility::make_tag_with_dashes (utility::vector1< int > res_vector, char const delimiter= ' ') |
| Compactifies vectors of ints: 1 2 3 9 10 11 to "1-3 9-11". More... | |
| std::string | utility::make_tag_with_dashes (utility::vector1< int > res_vector, utility::vector1< char > chain_vector, char const delimiter) |
| std::string | utility::make_tag (utility::vector1< int > res_vector) |
| std::pair< std::vector< int > , std::vector< char > > | utility::get_resnum_and_chain (std::string const &s, bool &string_is_ok) |
| converts string like "1-3 20-22" or "A:1-5 B:20-22" to vectors containing resnums and chains. More... | |
| bool | utility::get_resnum_and_chain_from_one_tag (std::string const &tag, std::vector< int > &resnum, std::vector< char > &chains) |
| helper function for get_resnum_and_chain More... | |
| platform::Size | utility::get_num_digits (platform::Size value) |
| std::string | utility::replace_in (std::string const name_in, std::string const find_string, std::string const replace_string) |
| find/replace strings within input string. More... | |
Some std::string helper functions.
1.8.7