#include <leetcode.h>
◆ simplifyPath()
string leetcode::simplify_path::Solution::simplifyPath |
( |
const string & |
path | ) |
|
|
static |
在文件 leetcode.cpp 第 560 行定义.
561 auto *
const str_cpy =
new char[path.size() + 1];
562 memcpy(str_cpy, path.c_str(), path.size() + 1);
563 auto *next = strtok(str_cpy,
"/");
564 auto stck = deque<string>();
565 while(next !=
nullptr) {
566 auto nextstr = string(next);
567 if(nextstr ==
"..") {
571 next = strtok(
nullptr,
"/");
575 next = strtok(
nullptr,
"/");
578 stck.emplace_back(next);
579 next = strtok(
nullptr,
"/");
581 auto oss = ostringstream();
585 while(!stck.empty()) {
586 auto pname = stck.front();
被这些函数引用 leetcode::simplify_path::TEST().
该类的文档由以下文件生成: