M5Utility 0.0.2 git rev:5c1a751
Loading...
Searching...
No Matches
string.hpp File Reference

Utilities for string. More...

#include <string>
#include <cstdint>

Go to the source code of this file.

Namespaces

namespace  m5
 Top level namespace of M5.
 

Functions

std::string m5::utility::formatString (const char *fmt,...)
 @ brief Create a string in a format similar to printf
 
Trim
std::string & m5::utility::trimRight (std::string &s)
 Trim right.
 
std::string & m5::utility::trimLeft (std::string &s)
 Trim left.
 
std::string & m5::utility::trim (std::string &s)
 Trim both ends.
 
Convert
template<bool Case = true>
constexpr char m5::utility::uintToHexChar (const uint8_t v)
 Convert from 0~15 to hexadecimal character.
 
template<typename T , bool Case = true>
std::string m5::utility::unsignedToHexString (const T &v)
 Convert any one unsigned integer to a hexadecimal string.
 

Detailed Description

Utilities for string.

Function Documentation

◆ trimRight()

std::string & m5::utility::trimRight ( std::string & s)

Trim right.

Warning
The string entered will be changed

◆ uintToHexChar()

template<bool Case = true>
char m5::utility::uintToHexChar ( const uint8_t v)
constexpr

Convert from 0~15 to hexadecimal character.

Template Parameters
CaseCapitalise if true

◆ unsignedToHexString()

template<typename T , bool Case = true>
std::string m5::utility::unsignedToHexString ( const T & v)

Convert any one unsigned integer to a hexadecimal string.

Template Parameters
TValue type (Must be unsigned integer)