openMSX
Classes | Functions
StringOp Namespace Reference

Classes

struct  casecmp
 
struct  caseless
 

Functions

int stringToInt (const string &str)
 
bool stringToInt (const string &str, int &result)
 
unsigned stringToUint (const string &str)
 
bool stringToUint (const string &str, unsigned &result)
 
uint64_t stringToUint64 (const string &str)
 
bool stringToBool (string_view str)
 
double stringToDouble (const string &str)
 
bool stringToDouble (const string &str, double &result)
 
string toLower (string_view str)
 
bool startsWith (string_view total, string_view part)
 
bool startsWith (string_view total, char part)
 
bool endsWith (string_view total, string_view part)
 
bool endsWith (string_view total, char part)
 
void trimRight (string &str, const char *chars)
 
void trimRight (string &str, char chars)
 
void trimRight (string_view &str, string_view chars)
 
void trimRight (string_view &str, char chars)
 
void trimLeft (string &str, const char *chars)
 
void trimLeft (string &str, char chars)
 
void trimLeft (string_view &str, string_view chars)
 
void trimLeft (string_view &str, char chars)
 
void trim (string_view &str, string_view chars)
 
void trim (string_view &str, char chars)
 
void splitOnFirst (string_view str, string_view chars, string_view &first, string_view &last)
 
void splitOnFirst (string_view str, char chars, string_view &first, string_view &last)
 
void splitOnLast (string_view str, string_view chars, string_view &first, string_view &last)
 
void splitOnLast (string_view str, char chars, string_view &first, string_view &last)
 
vector< string_viewsplit (string_view str, char chars)
 
vector< unsigned > parseRange (string_view str, unsigned min, unsigned max)
 

Function Documentation

◆ endsWith() [1/2]

bool StringOp::endsWith ( string_view  total,
string_view  part 
)

◆ endsWith() [2/2]

bool StringOp::endsWith ( string_view  total,
char  part 
)

Definition at line 82 of file StringOp.cc.

References string_view::back(), and string_view::empty().

◆ parseRange()

std::vector< unsigned > StringOp::parseRange ( string_view  str,
unsigned  min,
unsigned  max 
)

◆ split()

std::vector< string_view > StringOp::split ( string_view  str,
char  chars 
)

◆ splitOnFirst() [1/2]

void StringOp::splitOnFirst ( string_view  str,
string_view  chars,
string_view first,
string_view last 
)

◆ splitOnFirst() [2/2]

void StringOp::splitOnFirst ( string_view  str,
char  chars,
string_view first,
string_view last 
)

◆ splitOnLast() [1/2]

void StringOp::splitOnLast ( string_view  str,
string_view  chars,
string_view first,
string_view last 
)

◆ splitOnLast() [2/2]

void StringOp::splitOnLast ( string_view  str,
char  chars,
string_view first,
string_view last 
)

◆ startsWith() [1/2]

bool StringOp::startsWith ( string_view  total,
string_view  part 
)

◆ startsWith() [2/2]

bool StringOp::startsWith ( string_view  total,
char  part 
)

Definition at line 73 of file StringOp.cc.

References string_view::empty(), and string_view::front().

◆ stringToBool()

bool StringOp::stringToBool ( string_view  str)

◆ stringToDouble() [1/2]

double StringOp::stringToDouble ( const string &  str)

Definition at line 51 of file StringOp.cc.

◆ stringToDouble() [2/2]

bool StringOp::stringToDouble ( const string &  str,
double &  result 
)

Definition at line 55 of file StringOp.cc.

◆ stringToInt() [1/2]

int StringOp::stringToInt ( const string &  str)

◆ stringToInt() [2/2]

bool StringOp::stringToInt ( const string &  str,
int &  result 
)

Definition at line 18 of file StringOp.cc.

◆ stringToUint() [1/2]

unsigned StringOp::stringToUint ( const string &  str)

Definition at line 25 of file StringOp.cc.

◆ stringToUint() [2/2]

bool StringOp::stringToUint ( const string &  str,
unsigned &  result 
)

Definition at line 29 of file StringOp.cc.

◆ stringToUint64()

uint64_t StringOp::stringToUint64 ( const string &  str)

Definition at line 36 of file StringOp.cc.

◆ toLower()

std::string StringOp::toLower ( string_view  str)

◆ trim() [1/2]

void StringOp::trim ( string_view str,
string_view  chars 
)

Definition at line 139 of file StringOp.cc.

References trimLeft(), and trimRight().

Referenced by split().

◆ trim() [2/2]

void StringOp::trim ( string_view str,
char  chars 
)

Definition at line 145 of file StringOp.cc.

References trimLeft(), and trimRight().

◆ trimLeft() [1/4]

void StringOp::trimLeft ( string &  str,
const char *  chars 
)

Definition at line 118 of file StringOp.cc.

Referenced by openmsx::MSXtar::mkdir(), and trim().

◆ trimLeft() [2/4]

void StringOp::trimLeft ( string &  str,
char  chars 
)

Definition at line 122 of file StringOp.cc.

◆ trimLeft() [3/4]

void StringOp::trimLeft ( string_view str,
string_view  chars 
)

◆ trimLeft() [4/4]

void StringOp::trimLeft ( string_view str,
char  chars 
)

Definition at line 132 of file StringOp.cc.

References string_view::empty(), string_view::front(), and string_view::pop_front().

◆ trimRight() [1/4]

void StringOp::trimRight ( string &  str,
const char *  chars 
)

◆ trimRight() [2/4]

void StringOp::trimRight ( string &  str,
char  chars 
)

Definition at line 96 of file StringOp.cc.

◆ trimRight() [3/4]

void StringOp::trimRight ( string_view str,
string_view  chars 
)

◆ trimRight() [4/4]

void StringOp::trimRight ( string_view str,
char  chars 
)

Definition at line 111 of file StringOp.cc.

References string_view::back(), string_view::empty(), and string_view::pop_back().