20 lines
473 B
C++
20 lines
473 B
C++
// Copyright (C) 2020 Intel Corporation
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
namespace TimeTest {
|
|
/**
|
|
* @brief Get extension from filename
|
|
* @param filename - name of the file which extension should be extracted
|
|
* @return string with extracted file extension
|
|
*/
|
|
std::string fileExt(const std::string& filename) {
|
|
auto pos = filename.rfind('.');
|
|
if (pos == std::string::npos) return "";
|
|
return filename.substr(pos + 1);
|
|
}
|
|
} |