示例#1
0
stdStr Path::getExt(const stdStr& fileSpec)
{
  size_t pos = fileSpec.find_last_of(TEXT("."));
  if(pos < fileSpec.length())
    return toLower(fileSpec.substr(pos+1,fileSpec.length()-pos));
  return TEXT("");
}
示例#2
0
stdStr Path::getName(const stdStr &fileSpec)
{
  size_t pos = fileSpec.find_last_of(TEXT("/"));
  if(pos >= fileSpec.length())
    pos = fileSpec.find_last_of(TEXT("\\"));
  if(pos >= fileSpec.length())
    return toLower(fileSpec);
  return toLower(fileSpec.substr(pos+1,fileSpec.length()-pos));
}
示例#3
0
stdStr Path::getPath(const stdStr &fileSpec)
{
  size_t pos = fileSpec.find_last_of(TEXT("/"));
  if(pos >= fileSpec.length())
    pos = fileSpec.find_last_of(TEXT("\\"));
  if(pos >= fileSpec.length())
    return TEXT(".");
  if(fileSpec.find(TEXT("."),pos+1))
    return toLower(fileSpec.substr(0,pos+1));
  return fileSpec;
}
示例#4
0
std::wstring toUnicode(const stdStr& src)
{
  std::wstring temp;
  for(size_t i=0; i<src.length(); ++i)
    temp += static_cast<wchar_t>(src[i]);
  return temp;
}
示例#5
0
stdStr Path::toUpper(const stdStr& src)
{
  stdStr temp;
  for(size_t i=0; i<src.length(); ++i)
    temp += toupper(src[i]);
  return temp;
}