Struct StringUtil

struct StringUtil

A struct that encapsulates string utilities.

Public Static Functions

template<typename IterT>
static inline std::string join(IterT begin, IterT end, std::string const &separator)

Concatenate a sequence of values with a separator string.

This method takes a pair of iterators begin and end that define a sequence of values, and a separator string. It returns a string that concatenates all the values in the sequence with the separator string between each pair of values.

Template Parameters

IterT – A template parameter representing the iterator type.

Parameters
  • begin – An iterator pointing to the beginning of the sequence.

  • end – An iterator pointing to the end of the sequence.

  • separator – A string to insert between each pair of values.

Returns

A string containing the concatenated values.

template<typename IterT>
static inline std::string array_to_str(IterT begin, IterT end)

Convert a sequence of values to a string representation.

This method takes a pair of iterators begin and end that define a sequence of values. It returns a string that represents the sequence as a comma-separated list enclosed in square brackets.

Template Parameters

IterT – A template parameter representing the iterator type.

Parameters
  • begin – An iterator pointing to the beginning of the sequence.

  • end – An iterator pointing to the end of the sequence.

Returns

A string containing the string representation of the sequence.

template<typename IterT>
static inline std::string map_to_str(IterT begin, IterT end)

Generates a string representation of a std::map in the form “{key1: ‘value1’, key2: ‘value2’}”.

Template Parameters

IterT – Deduced iterator type

Parameters
  • begin – Start iterator. Use myMap.begin()

  • end – End iterator. Use myMap.end()

Returns

std::string

static bool str_contains(const std::string &str, const std::string &search_str)

Check if a string contains a substring.

This method takes two string arguments, str and search_str. It returns true if str contains search_str, and false otherwise.

Parameters
  • str – The string to search in.

  • search_str – The string to search for.

Returns

True if str contains search_str, false otherwise.

Previous Struct SerializeStageInterfaceProxy
Next Struct TableInfo
© Copyright 2024, NVIDIA. Last updated on Apr 25, 2024.