Format Functions

group FormatFunctions

This group consists of all the functions used for formatting.

Functions

std::string FormatBase(const std::string &format, std::initializer_list<std::string> args)

Outputs a string with all the “{}” replaced with each element in args inside format.

Return

An std::string with all the “{}” replaced with each element in args inside format.

Parameters
  • format: An const std::string & which needs to be formatted.

  • args: An std::initializer_list containing format args.

std::string FormatBase(std::string &&format, std::initializer_list<std::string> args)

Outputs an std::string with all the “{}” replaced with each element in args inside format.

Return

An std::string with all the “{}” replaced with each element in args inside format.

Parameters
  • format: An std::string && which needs to be formatted.

  • args: An std::initializer_list containing format args.

template<typename Type, typename ...IOSFlagTypes>
std::string ToString(const Type &t, IOSFlagTypes... flags)

Converts variable of type Type to std::string using operator<<.

Return

An std::string version of variable according to the operator<<.

Template Parameters
  • Type: Type of variable which will be converted.

  • IOSFlagTypes: A parameter pack of types of functors which will be passed to operator<<.

Parameters
  • t: Variable to convert to string.

  • flags: Flags to pass to stream before variable.

template<typename ...Args>
std::string Format(const std::string &format, Args... args)

Outputs a string with all the “{}” replaced with positional args inside format.

Return

- An std::string with all the “{}” replaced with args inside format.

Parameters
  • format: - An std::string which needs to be formatted.

  • args: - Argument pack of variables containing format args.

template<typename ...Args>
std::string Format(std::string &&format, Args... args)

Outputs a string with all the “{}” replaced with positional args inside format.

Return

An std::string with all the “{}” replaced with args inside format.

Parameters
  • format: An std::tring which needs to be formatted.

  • args: Argument pack of variables containing format args.