Loading...
Searching...
No Matches
string_utilities.h
Go to the documentation of this file.
35 [[nodiscard]] vector<string> convert_string_vector(const vector<vector<string>>&, const string&);
50 [[nodiscard]] time_t date_to_timestamp(const string&, Index = 0, const DateFormat& format = AUTO);
100 [[nodiscard]] inline string vector_to_string(const Eigen::DenseBase<Derived>& values, const string& separator = " ")
112 [[nodiscard]] string tensor_to_string(const TensorR<Rank>& values, const string& separator = " ")
Definition adaptive_moment_estimation.h:14
vector< string_view > get_token_views(string_view, char)
Splits a string view on the given separator, returning views into the original buffer.
string tensor_to_string(const TensorR< Rank > &values, const string &separator=" ")
Serializes a tensor's flat data to a string with the given separator.
Definition string_utilities.h:112
bool contains(const vector< string > &, const string &)
Returns true if the vector contains the given element.
void display_progress_bar(int, int)
Prints a textual progress bar to stdout for an in-progress operation.
string get_first_word(const string &)
Returns the first whitespace-delimited word of a string.
vector< string > get_tokens(const string &, const string &)
Splits a string on every occurrence of any character in the separator set.
void string_to_tensor(const string &input, TensorR< Rank > &values)
Parses a whitespace-separated string into the flat storage of a tensor.
Definition string_utilities.h:124
string vector_to_string(const vector< T > &values, const string &separator=" ")
Serializes a vector to a string with the given element separator.
Definition string_utilities.h:84
string get_time(float)
Formats a duration in seconds as a human-readable HH:MM:SS string.
string_view trim_view(string_view)
Returns a view onto the input with leading and trailing whitespace removed.
vector< string > tokenize(const string &)
Splits the input on whitespace into individual tokens.
time_t date_to_timestamp(const string &, Index=0, const DateFormat &format=AUTO)
Parses a date/time string into a Unix timestamp.
vector< string > convert_string_vector(const vector< vector< string > > &, const string &)
Joins each inner vector with the separator, returning one flattened string per row.
string get_trimmed(const string &)
Returns a copy of the string with leading and trailing whitespace removed.
vector< string_view > tokenize_views(string_view)
Whitespace-tokenises a string view, returning views into the source buffer.
void replace_all_appearances(string &, const string &, const string &)
Replaces every occurrence of a substring with another, in place.
void replace_all_word_appearances(string &, const string &, const string &)
Replaces every whole-word occurrence of a token with another, in place.
bool has_numbers(const vector< string > &)
Returns true if any element of the vector parses as a number.
bool is_date_time_string(string_view)
Returns true if the string matches one of the supported date/time formats.
void string_to_vector(const string &input, VectorR &values)
Parses a whitespace-separated string of floats into a VectorR.
DateFormat
Order of the day, month, and year fields in a date string (AUTO probes the input).
Definition string_utilities.h:44
bool is_numeric_string(string_view)
Returns true if the string can be parsed as a numeric literal.
void replace(string &, const string &, const string &)
In-place replacement of every occurrence of a substring with another.