20 [[nodiscard]] vector<string>
get_tokens(
const string&,
const string&);
29 [[nodiscard]] vector<string>
tokenize(
const string&);
67 void replace(
string&,
const string&,
const string&);
84 [[nodiscard]]
string vector_to_string(
const vector<T>& values,
const string& separator =
" ")
88 for (
size_t i = 0; i < values.size(); ++i)
91 if (i < values.size() - 1)
99 template <
typename Derived>
100 [[nodiscard]]
inline string vector_to_string(
const Eigen::DenseBase<Derived>& values,
const string& separator =
" ")
102 ostringstream buffer;
103 for (Index i = 0; i < values.size(); ++i) buffer << values(i) << separator;
111 template <
typename T,
size_t Rank>
114 ostringstream buffer;
116 for (Index i = 0; i < values.size(); ++i)
117 buffer << values(i) << separator;
123 template <
typename T,
size_t Rank>
126 istringstream stream(input);
130 while (stream >> value)
135 [[nodiscard]]
bool contains(
const vector<string>&,
const string&);
137 [[nodiscard]]
bool contains(
const vector<string>&, string_view);
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
@ YMD
Definition string_utilities.h:44
@ AUTO
Definition string_utilities.h:44
@ DMY
Definition string_utilities.h:44
@ MDY
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.
Matrix< float, Dynamic, 1 > VectorR
Definition pch.h:181
Tensor< float, Rank, Layout|AlignedMax > TensorR
Definition pch.h:194