a function to find the filename without extension
来源:互联网 发布:手机家具设计软件 编辑:程序博客网 时间:2024/03/29 13:54
string getFilename(string s) {
char sep = '/';
char sepExt='.';
#ifdef _WIN32
sep = '\\';
#endif
size_t i = s.rfind(sep, s.length( ));
if (i != string::npos) {
string fn= (s.substr(i+1, s.length( ) - i));
size_t j = fn.rfind(sepExt, fn.length( ));
if (i != string::npos) {
return fn.substr(0,j);
}else{
return fn;
}
}else{
return "";
}
}
char sep = '/';
char sepExt='.';
#ifdef _WIN32
sep = '\\';
#endif
size_t i = s.rfind(sep, s.length( ));
if (i != string::npos) {
string fn= (s.substr(i+1, s.length( ) - i));
size_t j = fn.rfind(sepExt, fn.length( ));
if (i != string::npos) {
return fn.substr(0,j);
}else{
return fn;
}
}else{
return "";
}
}
- a function to find the filename without extension
- Write a function to find the depth of a binary tree
- Write a function to find the depth of a binary tree
- [Segmentation Fault] Oops! The filename points to a constant string
- filename extension
- Write a function to find the longest common common string amongst an array of strings.
- Write a function to find the longest common prefix string amongst an array of strings.
- 4、Write a function to find the longest common prefix string amongst an array of strings
- safariDriver: Unable to establish a connection with the SafariDriver extension
- cannot add a child that doesnot have a YogoNode to a parent without a measure function!
- Mailscanner Attempt to hide real filename extension (themeManager.x10.rel)
- "The file you are trying to open, '[filename]', is in a different format" Excel Error
- Failed to set the 'value' property on 'HTMLInputElement': This input element accepts a filename,...
- Write a program to convert string to number without using library function。
- A function to retrieve the directory of a program
- A way to get filename from batch
- Given a string, find the length of the longest substring without repeating characters
- a pointer to a bound function may only be used to call the function
- Android获取指定某年某月某日相对应星期,某年某月有几天
- Linux 6 Transparent Huge Pages and Hadoop Workloads
- 参数 指针
- 采用Ruby 实现丢手帕问题
- Yii --Command 任务处理
- a function to find the filename without extension
- dos批量替换当前目录后缀名
- windows核心编程(笔记二)
- 黑苹果安装
- java移位运算符 《》
- 打印 GCC编译动态和静态链接库
- 哈夫曼编码的C语言实现
- Android如何使用从Github上下载的开源项目
- Ubuntu下关于Mysql及其图形界面的配置