Oxygen Engine
Modern C++ 3D Engine using OpenGL
Loading...
Searching...
No Matches
oe::util::str Namespace Reference

Functions

std::vector< std::string > split (const std::string &input, const char separator)
 
std::vector< std::string > split (const std::string &input, const std::string &separator)
 
bool replace (std::string &str, const std::string &from, const std::string &to)
 
std::string bytesToStr (const ByteArray &input)
 
ByteArray strToBytes (const std::string &input)
 
std::string bytesToHex (const ByteArray &input, bool uppercase=false)
 
ByteArray hexToBytes (const std::string &input)
 
const std::string getBasename (const std::string &path, int show_parent_level=0)
 
const std::string sanitizeFilename (const std::string &filename, const char replace_invalid_to='_')
 
const std::string removeFileExtension (const std::string &filename)
 
const std::string removeFileExtension (const std::string &filename, std::string &extension)
 

Detailed Description

Various string utils

Function Documentation

◆ bytesToHex()

std::string oe::util::str::bytesToHex ( const ByteArray &  input,
bool  uppercase = false 
)

Convert byte data to an hexadecimal representation (e.g. to display hash functions results)

◆ bytesToStr()

std::string oe::util::str::bytesToStr ( const ByteArray &  input)

Convert byte data to string (note: might produce garbage characters when used with non-ASCII data)

◆ hexToBytes()

ByteArray oe::util::str::hexToBytes ( const std::string &  input)

Convert an hexadecimal representation to byte data

◆ replace()

bool oe::util::str::replace ( std::string &  str,
const std::string &  from,
const std::string &  to 
)

Replace all occurences of a string within a string

◆ split() [1/2]

std::vector< std::string > oe::util::str::split ( const std::string &  input,
const char  separator 
)

Cut a string into pieces (uses a single char as separator)

◆ split() [2/2]

std::vector< std::string > oe::util::str::split ( const std::string &  input,
const std::string &  separator 
)

Cut a string into pieces (uses a string as separator)

◆ strToBytes()

ByteArray oe::util::str::strToBytes ( const std::string &  input)

Convert string to byte data