Add C++ version of function StripBackslash()
This commit is contained in:
parent
13d2b4f059
commit
08e43413cf
@ -200,6 +200,7 @@ std::string& AddBackslash(std::string& p);
|
|||||||
|
|
||||||
// Remove one trailing directory-delimiter character ('\\' in DOS-based, '/' in unix-based OS)
|
// Remove one trailing directory-delimiter character ('\\' in DOS-based, '/' in unix-based OS)
|
||||||
char* StripBackslash(char* p);
|
char* StripBackslash(char* p);
|
||||||
|
std::string& StripBackslash(std::string& p);
|
||||||
|
|
||||||
// Copy pathname with enviroment variables substitution and adds directory delimiter char.
|
// Copy pathname with enviroment variables substitution and adds directory delimiter char.
|
||||||
// Copy not more sizeof(Path) characters (__dst should be type "Path" or equvalence, size is GMAXPATH)
|
// Copy not more sizeof(Path) characters (__dst should be type "Path" or equvalence, size is GMAXPATH)
|
||||||
|
@ -49,6 +49,18 @@ std::string& AddBackslash(std::string& p) {
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------
|
||||||
|
// Remove one trailing directory-delimiter character ('\\' in DOS-based, '/' in unix-based OS)
|
||||||
|
|
||||||
|
std::string& StripBackslash(std::string& p) {
|
||||||
|
|
||||||
|
std::string::iterator pend = p.end();
|
||||||
|
|
||||||
|
if(isslash(*pend))
|
||||||
|
p.erase(pend);
|
||||||
|
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
// Add path to filename, if no path is set. Don't chech size of 'path', be careful!
|
// Add path to filename, if no path is set. Don't chech size of 'path', be careful!
|
||||||
|
Reference in New Issue
Block a user