ilang  1.1.4
ILAng: A Modeling and Verification Platform for SoCs
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros
Namespaces | Functions
str_util.h File Reference
#include <algorithm>
#include <functional>
#include <string>
#include <vector>

Go to the source code of this file.

Namespaces

 ilang
 

Functions

std::string ilang::IntToStrCustomBase (uint64_t value, unsigned base, bool uppercase)
 Transform int to string with different bases.
 
std::string ilang::StrToUpper (const std::string &str)
 Transform basic string to upper case.
 
std::string ilang::StrToLower (const std::string &str)
 Transform basic string to lower case.
 
bool ilang::StrToBool (const std::string &str)
 Return true if string is "true" or "True".
 
int ilang::StrToInt (const std::string &str, int base=10)
 Return the value represented in the string, e.g. "10".
 
long long ilang::StrToLong (const std::string &str, int base=10)
 Return the value represented in the string in long type, e.g. "10".
 
unsigned long long ilang::StrToULongLong (const std::string &str, int base=10)
 Return the value represented in the string in unsigned long long, e.g. "10".
 
void ilang::StrLeftTrim (std::string &s)
 Trim a string from start (in place)
 
void ilang::StrRightTrim (std::string &s)
 Trim a string from end (in place)
 
void ilang::StrTrim (std::string &s)
 Trim a string from both ends (in place)
 
std::vector< std::string > ilang::Split (const std::string &str, const std::string &delim)
 Python-style split , return a vector of splitted strings.
 
std::vector< std::string > ilang::SplitSpaceTabEnter (const std::string &str)
 Python-style split behavior, delim: space tab enter and their combiniations.
 
std::string ilang::Join (const std::vector< std::string > &in, const std::string &delim)
 Python-style join, return a string that joins the list by the delim.
 
std::string ilang::RemoveWhiteSpace (const std::string &in)
 Remove whitespace " \n\t\r\f\v" from the input string.
 
std::string ilang::ReplaceAll (const std::string &str, const std::string &a, const std::string &b)
 Replace all occurrance of substring a by substring b.
 
std::vector< std::string > ilang::ReFindList (const std::string &s, const std::string &re)
 Filter out a list of substring by the regular expression.
 
std::vector< std::string > ilang::ReFindAndDo (const std::string &s, const std::string &re, std::function< std::string(std::string)> f)
 
bool ilang::IsRExprUsable ()
 
bool ilang::StrEndsWith (const std::string &str, const std::string &suffix)
 Finds out if str ends with suffix.
 
bool ilang::StrStartsWith (const std::string &str, const std::string &prefix)
 Finds out if str starts with prefix.
 

Detailed Description

Header for some utily functions for string formating.