本文整理汇总了C++中UnicodeString::LastDelimiter方法的典型用法代码示例。如果您正苦于以下问题:C++ UnicodeString::LastDelimiter方法的具体用法?C++ UnicodeString::LastDelimiter怎么用?C++ UnicodeString::LastDelimiter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnicodeString
的用法示例。
在下文中一共展示了UnicodeString::LastDelimiter方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MaskFileName
//---------------------------------------------------------------------------
UnicodeString MaskFileName(const UnicodeString & FileName, const UnicodeString & Mask)
{
UnicodeString Result = FileName;
if (IsEffectiveFileNameMask(Mask))
{
bool Masked;
intptr_t P = Mask.LastDelimiter(L".");
if (P > 0)
{
intptr_t P2 = Result.LastDelimiter(".");
// only dot at beginning of file name is not considered as
// name/ext separator
UnicodeString FileExt = P2 > 1 ?
Result.SubString(P2 + 1, Result.Length() - P2) : UnicodeString();
FileExt = MaskFilePart(FileExt, Mask.SubString(P + 1, Mask.Length() - P), Masked);
if (P2 > 1)
{
Result.SetLength(P2 - 1);
}
Result = MaskFilePart(Result, Mask.SubString(1, P - 1), Masked);
if (!FileExt.IsEmpty())
{
Result += L"." + FileExt;
}
}
else
{
Result = MaskFilePart(Result, Mask, Masked);
}
}
return Result;
}
示例2: ValidateName
void TCopyParamList::ValidateName(const UnicodeString & Name)
{
if (Name.LastDelimiter(CONST_INVALID_CHARS) > 0)
{
throw Exception(FMTLOAD(ITEM_NAME_INVALID, Name.c_str(), CONST_INVALID_CHARS));
}
}
示例3: ValidateName
//---------------------------------------------------------------------
void __fastcall TCopyParamList::ValidateName(const UnicodeString Name)
{
if (Name.LastDelimiter(FInvalidChars) > 0)
{
throw Exception(FMTLOAD(ITEM_NAME_INVALID, (Name, FInvalidChars)));
}
}
示例4: ValidateName
//---------------------------------------------------------------------
void TCopyParamList::ValidateName(const UnicodeString & Name)
{
if (Name.LastDelimiter(FInvalidChars) > 0)
{
throw Exception(FMTLOAD(ITEM_NAME_INVALID, Name.c_str(), FInvalidChars.c_str()));
}
}
示例5: TrimVersion
//---------------------------------------------------------------------------
UnicodeString TConfiguration::TrimVersion(const UnicodeString & Version) const
{
UnicodeString Result = Version;
while ((Result.Pos(L".") != Result.LastDelimiter(L".")) &&
(Result.SubString(Result.Length() - 1, 2) == L".0"))
{
Result.SetLength(Result.Length() - 2);
}
return Result;
}
示例6: MakeDirectoryMask
//---------------------------------------------------------------------------
UnicodeString TFileMasks::MakeDirectoryMask(const UnicodeString & Str)
{
assert(!Str.IsEmpty());
UnicodeString Result = Str;
if (Result.IsEmpty() || !Result.IsDelimiter(DirectoryMaskDelimiters, Result.Length()))
{
intptr_t D = Result.LastDelimiter(DirectoryMaskDelimiters);
// if there's any [back]slash anywhere in str,
// add the same [back]slash at the end, otherwise add slash
wchar_t Delimiter = (D > 0) ? Result[D] : DirectoryMaskDelimiters[1];
Result += Delimiter;
}
return Result;
}
示例7: ExtractFileDir
UnicodeString ExtractFileDir(const UnicodeString & Str)
{
UnicodeString Result;
intptr_t Pos = Str.LastDelimiter(L"/\\");
// it used to return Path when no slash was found
if (Pos > 0)
{
Result = Str.SubString(1, Pos);
}
else
{
Result = (Pos == 1) ? UnicodeString(L"/") : UnicodeString();
}
return Result;
}
示例8: CreateMask
//---------------------------------------------------------------------------
void TFileMasks::CreateMask(
const UnicodeString & MaskStr, intptr_t MaskStart, intptr_t /*MaskEnd*/, bool Include)
{
bool Directory = false; // shut up
TMask Mask;
Mask.MaskStr = MaskStr;
Mask.UserStr = MaskStr;
Mask.FileNameMask.Kind = TMaskMask::Any;
Mask.FileNameMask.Mask = nullptr;
Mask.DirectoryMask.Kind = TMaskMask::Any;
Mask.DirectoryMask.Mask = nullptr;
Mask.HighSizeMask = TMask::None;
Mask.LowSizeMask = TMask::None;
Mask.HighModificationMask = TMask::None;
Mask.LowModificationMask = TMask::None;
wchar_t NextPartDelimiter = L'\0';
intptr_t NextPartFrom = 1;
while (NextPartFrom <= MaskStr.Length())
{
wchar_t PartDelimiter = NextPartDelimiter;
intptr_t PartFrom = NextPartFrom;
UnicodeString PartStr = CopyToChars(MaskStr, NextPartFrom, L"<>", false, &NextPartDelimiter, true);
intptr_t PartStart = MaskStart + PartFrom - 1;
intptr_t PartEnd = MaskStart + NextPartFrom - 1 - 2;
TrimEx(PartStr, PartStart, PartEnd);
if (PartDelimiter != L'\0')
{
bool Low = (PartDelimiter == L'>');
TMask::TMaskBoundary Boundary;
if ((PartStr.Length() >= 1) && (PartStr[1] == L'='))
{
Boundary = TMask::Close;
PartStr.Delete(1, 1);
}
else
{
Boundary = TMask::Open;
}
TFormatSettings FormatSettings = TFormatSettings::Create(GetDefaultLCID());
FormatSettings.DateSeparator = L'-';
FormatSettings.TimeSeparator = L':';
FormatSettings.ShortDateFormat = L"yyyy/mm/dd";
FormatSettings.ShortTimeFormat = L"hh:nn:ss";
TDateTime Modification;
if (TryStrToDateTime(PartStr, Modification, FormatSettings) ||
TryRelativeStrToDateTime(PartStr, Modification))
{
TMask::TMaskBoundary & ModificationMask =
(Low ? Mask.LowModificationMask : Mask.HighModificationMask);
if ((ModificationMask != TMask::None) || Directory)
{
// include delimiter into size part
ThrowError(PartStart - 1, PartEnd);
}
ModificationMask = Boundary;
(Low ? Mask.LowModification : Mask.HighModification) = Modification;
}
else
{
TMask::TMaskBoundary & SizeMask = (Low ? Mask.LowSizeMask : Mask.HighSizeMask);
__int64 & Size = (Low ? Mask.LowSize : Mask.HighSize);
if ((SizeMask != TMask::None) || Directory)
{
// include delimiter into size part
ThrowError(PartStart - 1, PartEnd);
}
SizeMask = Boundary;
Size = ParseSize(PartStr);
}
}
else if (!PartStr.IsEmpty())
{
intptr_t D = PartStr.LastDelimiter(DirectoryMaskDelimiters);
Directory = (D > 0) && (D == PartStr.Length());
if (Directory)
{
do
{
PartStr.SetLength(PartStr.Length() - 1);
Mask.UserStr.Delete(PartStart - MaskStart + D, 1);
D--;
}
while (PartStr.IsDelimiter(DirectoryMaskDelimiters, PartStr.Length()));
D = PartStr.LastDelimiter(DirectoryMaskDelimiters);
//.........这里部分代码省略.........
示例9: IsMask
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
bool TFileMasks::IsMask(const UnicodeString & Mask)
{
return (Mask.LastDelimiter(L"?*[/") > 0);
}
示例10: PropertyToKey
UnicodeString TConfiguration::PropertyToKey(const UnicodeString & Property)
{
// no longer useful
intptr_t P = Property.LastDelimiter(L".>");
return Property.SubString(P + 1, Property.Length() - P);
}