本文整理汇总了C++中UnicodeString::Length方法的典型用法代码示例。如果您正苦于以下问题:C++ UnicodeString::Length方法的具体用法?C++ UnicodeString::Length怎么用?C++ UnicodeString::Length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnicodeString
的用法示例。
在下文中一共展示了UnicodeString::Length方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PrintDoc
void PrintDoc(seakgOutput *pOutput, UnicodeString filename, UnicodeString name, UnicodeString uuid, UnicodeString code) {
filename = filename.SubString(rootPath.Length()+1, filename.Length() - rootPath.Length());
UnicodeString id = "";
// UnicodeString id = "";
code = encoding_html(code);
name = encoding_html(name);
TGUID g;
OleCheck(CoCreateGuid(&g));
//Sysutils::GUIDToString(g);
//id = Sysutils::GUIDToString(g);
//id = id.SubString(2,37) + "[" + IntToStr(g_nInc++) + "]";
id = IntToStr(g_nInc++);
while (id.Length() < 6)
id = "0" + id;
id = prefixforid + id;
pOutput->addline("\t<doc>");
pOutput->addline("\t\t<field name=\"id\">" + id + "</field>");
pOutput->addline("\t\t<field name=\"project\">" + projectName + "</field>");
pOutput->addline("\t\t<field name=\"name\">" + name + "</field>");
pOutput->addline("\t\t<field name=\"uuid\">" + uuid.UpperCase() + "</field>");
pOutput->addline("\t\t<field name=\"source_filepath\">" + filename + "</field>");
pOutput->addline("\t\t<field name=\"full_source_code\">\n" + code + "\n\t\t</field>");
pOutput->addline("\t</doc>");
};
示例2: SetText
//---------------------------------------------------------------------------
void __fastcall TRightsFrame::SetText(UnicodeString value)
{
if (Text != value)
{
UnicodeString RightsStr = value;
int P = RightsStr.LowerCase().Pos(FAddXToDirectoriesSuffix);
bool AAddXToDirectories = (P > 0);
if (AAddXToDirectories)
{
RightsStr.Delete(P, FAddXToDirectoriesSuffix.Length());
}
RightsStr = DeleteChar(DeleteChar(RightsStr, L'('), L')').Trim();
TRights R = Rights;
if (((RightsStr.Length() == 3) || (RightsStr.Length() == 4)) &&
IsNumber(RightsStr))
{
R.Octal = RightsStr;
}
else
{
R.Text = RightsStr;
}
Rights = R;
AddXToDirectories = AAddXToDirectories;
}
}
示例3: TrimEx
//---------------------------------------------------------------------------
void TFileMasks::TrimEx(UnicodeString & Str, intptr_t & Start, intptr_t & End)
{
UnicodeString Buf = TrimLeft(Str);
Start += Str.Length() - Buf.Length();
Str = TrimRight(Buf);
End -= Buf.Length() - Str.Length();
}
示例4: AppendPathDelimiterW
void AppendPathDelimiterW(UnicodeString & Str)
{
if (!Str.IsEmpty() && Str[Str.Length()] != L'/' && Str[Str.Length()] != L'\\')
{
Str += L"\\";;
}
}
示例5: 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;
}
示例6: GetTextStr
UnicodeString TStrings::GetTextStr() const
{
UnicodeString Result;
intptr_t Count = GetCount();
intptr_t Size = 0;
UnicodeString LB = sLineBreak;
for (intptr_t I = 0; I < Count; I++)
{
Size += GetString(I).Length() + LB.Length();
}
Result.SetLength(Size);
wchar_t * P = const_cast<wchar_t *>(Result.c_str());
for (intptr_t I = 0; I < Count; I++)
{
UnicodeString S = GetString(I);
intptr_t L = S.Length() * sizeof(wchar_t);
if (L != 0)
{
memmove(P, S.c_str(), L);
P += S.Length();
}
L = LB.Length() * sizeof(wchar_t);
if (L != 0)
{
memmove(P, LB.c_str(), L);
P += LB.Length();
}
}
return Result;
}
示例7: FileSearch
UnicodeString FileSearch(const UnicodeString & FileName, const UnicodeString & DirectoryList)
{
UnicodeString Temp;
UnicodeString Result;
Temp = DirectoryList;
UnicodeString PathSeparators = L"/\\";
do
{
intptr_t I = ::Pos(Temp, PathSeparators);
while ((Temp.Length() > 0) && (I == 0))
{
Temp.Delete(1, 1);
I = ::Pos(Temp, PathSeparators);
}
I = ::Pos(Temp, PathSeparators);
if (I > 0)
{
Result = Temp.SubString(1, I - 1);
Temp.Delete(1, I);
}
else
{
Result = Temp;
Temp = L"";
}
Result = ::IncludeTrailingBackslash(Result);
Result = Result + FileName;
if (!::FileExists(Result))
{
Result = L"";
}
}
while (!(Temp.Length() == 0) || (Result.Length() != 0));
return Result;
}
示例8: Add
void TOptions::Add(const UnicodeString & Value)
{
if (!FNoMoreSwitches &&
(Value.Length() == 2) &&
(Value[1] == Value[2]) &&
(FSwitchMarks.Pos(Value[1]) > 0))
{
FNoMoreSwitches = true;
}
else
{
bool Switch = false;
intptr_t Index = 0; // shut up
if (!FNoMoreSwitches &&
(Value.Length() >= 2) &&
(FSwitchMarks.Pos(Value[1]) > 0))
{
Index = 2;
Switch = true;
while (Switch && (Index <= Value.Length()))
{
if (Value.IsDelimiter(FSwitchValueDelimiters, Index))
{
break;
}
// this is to treat /home/martin as parameter, not as switch
else if ((Value[Index] != L'?') && !IsLetter(Value[Index]))
{
Switch = false;
break;
}
++Index;
}
}
if (Switch)
{
TOption Option;
Option.Type = otSwitch;
Option.Name = Value.SubString(2, Index - 2);
Option.Value = Value.SubString(Index + 1, Value.Length());
Option.Used = false;
FOptions.push_back(Option);
}
else
{
TOption Option;
Option.Type = otParam;
Option.Value = Value;
Option.Used = false;
FOptions.push_back(Option);
++FParamCount;
}
}
FOriginalOptions = FOptions;
}
示例9: SetStr
//---------------------------------------------------------------------------
void TFileMasks::SetStr(const UnicodeString & Str, bool SingleMask)
{
UnicodeString Backup = FStr;
try
{
FStr = Str;
Clear();
intptr_t NextMaskFrom = 1;
bool Include = true;
while (NextMaskFrom <= Str.Length())
{
intptr_t MaskStart = NextMaskFrom;
wchar_t NextMaskDelimiter;
UnicodeString MaskStr;
if (SingleMask)
{
MaskStr = Str;
NextMaskFrom = Str.Length() + 1;
NextMaskDelimiter = L'\0';
}
else
{
MaskStr = CopyToChars(Str, NextMaskFrom, AllFileMasksDelimiters, false, &NextMaskDelimiter, true);
}
intptr_t MaskEnd = NextMaskFrom - 2;
TrimEx(MaskStr, MaskStart, MaskEnd);
if (!MaskStr.IsEmpty())
{
CreateMask(MaskStr, MaskStart, MaskEnd, Include);
}
if (NextMaskDelimiter == IncludeExcludeFileMasksDelimiter)
{
if (Include)
{
Include = false;
}
else
{
ThrowError(NextMaskFrom - 1, Str.Length());
}
}
}
}
catch(...)
{
// this does not work correctly if previous mask was set using SetMask.
// this should not fail (the mask was validated before),
// otherwise we end in an infinite loop
SetStr(Backup, false);
throw;
}
}
示例10: IncludeTrailingBackslash
UnicodeString IncludeTrailingBackslash(const UnicodeString & Str)
{
UnicodeString Result = Str;
if ((Str.Length() == 0) || ((Str[Str.Length()] != L'/') &&
(Str[Str.Length()] != L'\\')))
{
Result += L'\\';
}
return Result;
}
示例11: ExcludeTrailingBackslash
UnicodeString ExcludeTrailingBackslash(const UnicodeString & Str)
{
UnicodeString Result = Str;
if ((Str.Length() > 0) && ((Str[Str.Length()] == L'/') ||
(Str[Str.Length()] == L'\\')))
{
Result.SetLength(Result.Length() - 1);
}
return Result;
}
示例12: 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;
}
示例13: ReplaceStrAll
UnicodeString ReplaceStrAll(const UnicodeString & Str, const UnicodeString & What, const UnicodeString & ByWhat)
{
UnicodeString Result = Str;
intptr_t Pos = Result.Pos(What);
while (Pos > 0)
{
Result.Replace(Pos, What.Length(), ByWhat.c_str(), ByWhat.Length());
Pos = Result.Pos(What);
}
return Result;
}
示例14: StrToHex
//---------------------------------------------------------------------------
UnicodeString StrToHex(const UnicodeString & Str, bool UpperCase, char Separator)
{
UnicodeString Result;
for (intptr_t I = 1; I <= Str.Length(); I++)
{
Result += CharToHex(static_cast<char>(Str[I]), UpperCase);
if ((Separator != L'\0') && (I <= Str.Length()))
{
Result += Separator;
}
}
return Result;
}
示例15: FirstDelimiter
//---------------------------------------------------------------------------
intptr_t FirstDelimiter(const UnicodeString & Delimiters, const UnicodeString & Str)
{
if (Str.Length())
{
for (intptr_t I = 1; I <= Str.Length(); ++I)
{
if (Str.IsDelimiter(Delimiters, I))
{
return I;
}
}
}
return 0;
}