COMMON: Add new method joinComponents
This commit is contained in:
parent
91585f3d94
commit
0979c692de
2 changed files with 20 additions and 0 deletions
|
@ -276,6 +276,20 @@ Path Path::punycodeDecode() const {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Path Path::joinComponents(const StringArray& c) {
|
||||||
|
String res;
|
||||||
|
|
||||||
|
for (uint i = 0; i < c.size(); i++) {
|
||||||
|
res += c[i];
|
||||||
|
if (i + 1 < c.size())
|
||||||
|
res += DIR_SEPARATOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
Path ret;
|
||||||
|
ret._str = res;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
// See getIdentifierString() for more details.
|
// See getIdentifierString() for more details.
|
||||||
// This does the same but for a single path component and is used by
|
// This does the same but for a single path component and is used by
|
||||||
// getIdentifierString().
|
// getIdentifierString().
|
||||||
|
|
|
@ -215,6 +215,12 @@ public:
|
||||||
* 2 separots follow each other
|
* 2 separots follow each other
|
||||||
*/
|
*/
|
||||||
StringArray splitComponents() const;
|
StringArray splitComponents() const;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opposite of splitComponents
|
||||||
|
*/
|
||||||
|
static Path joinComponents(const StringArray& c);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue