给定一个字符串"filename.conf",如何验证扩展部分?
我需要一个跨平台的解决方案.
假设我有一个分配给字符串变量的文本文件“myfile.txt”,我想删除点和扩展文件字符的其余部分.txt
#include <stdio.h>
#include <string>
#incldue <iostream>
int main() {
std::string F = "myfile.txt";
return 0;
}
Run Code Online (Sandbox Code Playgroud)
所以我想要实现的输出是“myfile”。使用 std::size 看起来并不适用于我的情况,有没有办法可以构建我想要的东西?