本文整理汇总了C++中UnicodeString::RPos方法的典型用法代码示例。如果您正苦于以下问题:C++ UnicodeString::RPos方法的具体用法?C++ UnicodeString::RPos怎么用?C++ UnicodeString::RPos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnicodeString
的用法示例。
在下文中一共展示了UnicodeString::RPos方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ChangeFileExtension
//
// Modifies the Filename's extension. The period is considered part
// of the extension.
//
// "/foo/bar/baz.txt", ".dat" --> "/foo/bar/baz.dat"
// "/foo/bar/baz.txt", "" --> "/foo/bar/baz"
// "/foo/bar/baz", ".txt" --> "/foo/bar/baz.txt"
//
UnicodeString ChangeFileExtension(const UnicodeString & Path, const UnicodeString & Ext, wchar_t Delimiter)
{
UnicodeString FileName = ExtractFilename(Path, Delimiter);
return ExtractDirectory(Path, Delimiter)
+ FileName.SubString(1, FileName.RPos(L'.'))
+ Ext;
}
示例2: ExtractFileExtension
//
// Returns the file's extension, if any. The period is considered part
// of the extension.
//
// "/foo/bar/baz.txt" --> ".txt"
// "/foo/bar/baz" --> ""
UnicodeString ExtractFileExtension(const UnicodeString & Path, wchar_t Delimiter)
{
UnicodeString FileName = ExtractFilename(Path, Delimiter);
intptr_t N = FileName.RPos(L'.');
if (N > 0)
{
return FileName.SubString(N);
}
return UnicodeString();
}
示例3: ExtractFilename
//
// Returns only the Filename part of the Path.
//
// "/foo/bar/baz.txt" --> "baz.txt"
UnicodeString ExtractFilename(const UnicodeString & Path, wchar_t Delimiter)
{
return Path.SubString(Path.RPos(Delimiter) + 1);
}
示例4: ExtractDirectory
//
// Returns everything, including the trailing Path separator, except the Filename
// part of the Path.
//
// "/foo/bar/baz.txt" --> "/foo/bar/"
UnicodeString ExtractDirectory(const UnicodeString & Path, wchar_t Delimiter)
{
return Path.SubString(1, Path.RPos(Delimiter) + 1);
}