byteman  1.3 (Build #225)
Bitstream relocation and manipulation tool
Namespaces | Functions
str Namespace Reference

Namespaces

 iff
 
 parse
 

Functions

void findAndReplace (std::string &str, std::string toFind, std::string toReplaceWith)
 
std::string findStringAndGetAllAfter (std::string checkedString, std::string searchString)
 Finds string searchString inside checkedString and returns all to the right inside checkedString. If can't be found, returns empty string. More...
 
std::string removeExternalQuotes (std::string str)
 Removes double quotes from start and end of string str and returns the resulting string. More...
 
std::string removeSpaces (std::string str)
 Removes all space chars of str returns the resulting string. More...
 
std::string replace (std::string str, char oldChar, char newChar)
 Replaces all instances of oldChar in string str with newChar and returns the resulting string. More...
 
std::string stringToLower (std::string str)
 Replaces all uppercase characters in str with lowercase and returns the resulting string. More...
 
std::string stringToUpper (std::string str)
 Replaces all lowercase characters in str with uppercase and returns the resulting string. More...
 

Detailed Description

The str::iff:: namespace holds some custom and/or shorter functions for string conditionals (searching/matching).

The str::parse:: namespace holds some custom and/or shorter functions for string parsing.

The str:: namespace holds some custom and/or shorter functions including string string parsing and string manipulation.

Function Documentation

◆ findAndReplace()

void str::findAndReplace ( std::string &  str,
std::string  toFind,
std::string  toReplaceWith 
)
inline

Definition at line 77 of file str.h.

78  {
79  size_t pos = str.find(toFind);
80  while( pos != std::string::npos) {
81  str.replace(pos, toFind.size(), toReplaceWith);
82  pos = str.find(toFind, pos + toReplaceWith.size());
83  }
84  }
Definition: iff.h:29

◆ findStringAndGetAllAfter()

std::string str::findStringAndGetAllAfter ( std::string  checkedString,
std::string  searchString 
)
inline

Finds string searchString inside checkedString and returns all to the right inside checkedString. If can't be found, returns empty string.

Definition at line 33 of file str.h.

34  {
35  size_t loc = checkedString.find(searchString);
36  if(std::string::npos == loc)
37  return std::string("");
38  return checkedString.substr(loc + searchString.size());
39  }

Referenced by byteman::parse().

Here is the caller graph for this function:

◆ removeExternalQuotes()

std::string str::removeExternalQuotes ( std::string  str)
inline

Removes double quotes from start and end of string str and returns the resulting string.

Definition at line 65 of file str.h.

66  {
67  if(str.empty())
68  return str;
69  if(str.front() == '"')
70  str.erase(str.begin());
71  if(str.empty())
72  return str;
73  if(str.back() == '"')
74  str.erase(str.end()-1);
75  return str;
76  }

◆ removeSpaces()

std::string str::removeSpaces ( std::string  str)
inline

Removes all space chars of str returns the resulting string.

Definition at line 47 of file str.h.

48  {
49  str.erase(remove_if(str.begin(), str.end(), ::isspace), str.end());
50  return str;
51  }

Referenced by XilinxSeries7::getDeviceByName(), XilinxUltraScale::getDeviceByName(), and XilinxUltraScalePlus::getDeviceByName().

Here is the caller graph for this function:

◆ replace()

std::string str::replace ( std::string  str,
char  oldChar,
char  newChar 
)
inline

Replaces all instances of oldChar in string str with newChar and returns the resulting string.

Definition at line 41 of file str.h.

42  {
43  replace(str.begin(), str.end(), oldChar, newChar);
44  return str;
45  }
std::string replace(std::string str, char oldChar, char newChar)
Replaces all instances of oldChar in string str with newChar and returns the resulting string.
Definition: str.h:41

Referenced by XilinxSeries7::assemblerAsmTo(), XilinxUltraScale::assemblerAsmTo(), XilinxUltraScalePlus::assemblerAsmTo(), byteman::parse(), parseParams(), and byteman::parseParamsAndRemoveThemFromString().

Here is the caller graph for this function:

◆ stringToLower()

std::string str::stringToLower ( std::string  str)
inline

Replaces all uppercase characters in str with lowercase and returns the resulting string.

Definition at line 59 of file str.h.

60  {
61  transform(str.begin(), str.end(), str.begin(), ::tolower);
62  return str;
63  }

Referenced by XilinxSeries7::getDeviceByName(), XilinxUltraScale::getDeviceByName(), XilinxUltraScalePlus::getDeviceByName(), byteman::parse(), byteman::parseTest(), and byteman::setArchitecture().

Here is the caller graph for this function:

◆ stringToUpper()

std::string str::stringToUpper ( std::string  str)
inline

Replaces all lowercase characters in str with uppercase and returns the resulting string.

Definition at line 53 of file str.h.

54  {
55  transform(str.begin(), str.end(), str.begin(), ::toupper);
56  return str;
57  }