OpenNN
Open-source neural networks library
Loading...
Searching...
No Matches
string_utilities.h File Reference
#include "pch.h"

Go to the source code of this file.

Namespaces

namespace  opennn
 

Enumerations

enum  opennn::DateFormat { opennn::AUTO , opennn::DMY , opennn::MDY , opennn::YMD }
 Order of the day, month, and year fields in a date string (AUTO probes the input). More...
 

Functions

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