本文整理汇总了C++中UnicodeString::Pos方法的典型用法代码示例。如果您正苦于以下问题:C++ UnicodeString::Pos方法的具体用法?C++ UnicodeString::Pos怎么用?C++ UnicodeString::Pos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnicodeString
的用法示例。
在下文中一共展示了UnicodeString::Pos方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getName
UnicodeString getName(UnicodeString str) {
UnicodeString name = str;
if (name.Pos(":") > 0)
name = name.SubString(1, name.Pos(":")-1);
UnicodeString alphabet = L"QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm1234567890_";
while (true) {
if (name.Length() == 0)
break;
UnicodeString ch = name.SubString(name.Length(), 1);
if (alphabet.Pos(ch) > 0 && name.Length() > 0)
break;
name = name.SubString(1, name.Length()-1);
}
UnicodeString temp_name;
while (true) {
if (name.Length() == 0)
break;
UnicodeString ch = name.SubString(name.Length(), 1);
if (alphabet.Pos(ch) > 0 && name.Length() > 0)
temp_name = ch + temp_name;
else
break;
name = name.SubString(1, name.Length()-1);
}
return temp_name;
}
示例2: tabelaOpusa
UnicodeString tabelaOpusa(UnicodeString Tabela)
{
if (Tabela.Pos("clienti_") == 0)
return "clienti_"+Tabela;
else
{
int pos = Tabela.Pos("_");
return Tabela.SubString(pos+1, Tabela.Length()-pos);
}
}
示例3: 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;
}
示例4: BookmarkFolderValidateName
//---------------------------------------------------------------------------
void __fastcall BookmarkFolderValidateName(const UnicodeString Name,
bool AllowEmpty)
{
if ((!AllowEmpty && Name.IsEmpty()) || Name.Pos(L"\\"))
{
throw Exception(FMTLOAD(BOOKMARK_FOLDER_INVALID_NAME, (Name)));
}
}
示例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: AnsiReplaceStr
UnicodeString AnsiReplaceStr(const UnicodeString & Str, const UnicodeString & From,
const UnicodeString & To)
{
UnicodeString Result = Str;
intptr_t Pos = 0;
while ((Pos = Result.Pos(From)) > 0)
{
Result.Replace(Pos, From.Length(), To);
}
return Result;
}
示例7: FormCloseQuery
//---------------------------------------------------------------------------
void __fastcall TCustomCommandDialog::FormCloseQuery(TObject * /*Sender*/,
bool & /*CanClose*/)
{
if (ModalResult == DefaultResult(this))
{
if ((FMode == ccmAdd) || (FMode == ccmEdit))
{
UnicodeString Desc = DescriptionEdit->Text;
if (Desc.Pos(L"=") > 0)
{
DescriptionEdit->SetFocus();
throw Exception(FMTLOAD(CUSTOM_COMMAND_INVALID, (L"=")));
}
if (((FMode == ccmAdd) || ((FMode == ccmEdit) && (Desc != FOrigDescription))) &&
(FCustomCommandList->Find(Desc) != 0))
{
DescriptionEdit->SetFocus();
throw Exception(FMTLOAD(CUSTOM_COMMAND_DUPLICATE, (Desc)));
}
}
try
{
bool RemoteCommand = RemoteCommandButton->Checked;
TRemoteCustomCommand RemoteCustomCommand;
TLocalCustomCommand LocalCustomCommand;
TFileCustomCommand * FileCustomCommand =
(RemoteCommand ? &RemoteCustomCommand : &LocalCustomCommand);
TInteractiveCustomCommand InteractiveCustomCommand(FileCustomCommand);
UnicodeString Command = CommandEdit->Text;
InteractiveCustomCommand.Validate(Command);
Command = InteractiveCustomCommand.Complete(Command, false);
FileCustomCommand->Validate(Command);
}
catch(...)
{
CommandEdit->SetFocus();
throw;
}
if (FOnValidate)
{
TCustomCommandType Command;
GetCommand(Command);
FOnValidate(Command);
}
}
}
示例8: UnMungeIniName
UnicodeString UnMungeIniName(const UnicodeString & Str)
{
intptr_t P = Str.Pos(L"%3D");
// make this fast for now
if (P > 0)
{
return ReplaceStr(Str, L"%3D", L"=");
}
else
{
return Str;
}
}
示例9: ScanAndPrint
void ScanAndPrint(seakgOutput *pOutput, UnicodeString fullname) {
TStringList *list = new TStringList();
list->LoadFromFile(fullname);
int nCount = list->Count;
for (int i = 0; i < nCount; i++)
{
UnicodeString str = list->Strings[i];
if (str.Pos(L"class") > 0 && str.Pos("__declspec") > 0) {
UnicodeString code = str + "\r\n";
str = str.Trim();
UnicodeString uuid = "none";
if (str.Pos("\"") > 0)
uuid = str.SubString(str.Pos("\"") + 1, 36);
UnicodeString interfacename = str.SubString(str.Pos("I"), str.Length() - str.Pos("I") + 1);
UnicodeString interfacename2 = getName(str);
bool bStop = false;
int nIncr = 0;
while (bStop == false && i < nCount) {
i++;
str = list->Strings[i];
if (str.Pos("{") > 0) {
nIncr++;
};
if (str.Pos("}") > 0) {
nIncr--;
if(nIncr == 0) bStop = true;
};
code += str + "\n";
};
PrintDoc(pOutput, fullname, interfacename2, uuid, code);
// std::wcout << str.c_str();
};
};
/*std::wcout << "createuuidprojectname: " << << "\r\n";
std::wcout << "projectname: " << projectName.c_str() << "\r\n";
std::wcout << "fullname: " << fullname.c_str() << "\r\n";*/
};
示例10: MatchesMaskMask
//---------------------------------------------------------------------------
bool TFileMasks::MatchesMaskMask(const TMaskMask & MaskMask, const UnicodeString & Str)
{
bool Result;
if (MaskMask.Kind == TMaskMask::Any)
{
Result = true;
}
else if ((MaskMask.Kind == TMaskMask::NoExt) && (Str.Pos(L".") == 0))
{
Result = true;
}
else
{
Result = MaskMask.Mask->Matches(Str);
}
return Result;
}
示例11: ESrvResponseError
//---------------------------------------------------------------------------
// TSrvResponse
//---------------------------------------------------------------------------
__fastcall TSrvResponse::TSrvResponse(UnicodeString ResponseText)
: TStringList()
{
if (ResponseText.IsEmpty()) throw ESrvResponseError(L"Server response is empty.");
this->Text = ResponseText;
try {
this->StatusCode = StrToInt(this->Strings[0]);
}
catch (EConvertError& e) {
throw ESrvResponseError(L"Cannot read status code. "+e.Message);
}
this->Delete(0); //Remove status code line
for (int i = this->Count-1; i >= 0; i--) {
UnicodeString line = this->Strings[i].Trim();
int split = line.Pos(L":");
if (split) {
this->Strings[i] = line.SubString(1, split-1).Trim() \
+ L":" \
+ line.SubString(split+1, line.Length()-split).Trim();
}
else {
this->Delete(i);
}
}
this->NameValueSeparator = ':';
if (this->StatusCode != 0) {
if (this->StatusCode < 0) throw ESrvResponseError(L"Negative status code not allowed.");
this->ErrorMessage = this->ReadString(TSrvResponseValID("ErrorMessage"), L"", true);
if (this->ErrorMessage.IsEmpty()) this->ErrorMessage = L"Error #"
+ IntToStr(this->StatusCode)
+ L" (No error message provided).";
}
else { //Find URLs
this->AvatarURL = this->Values[L"AvatarURL"];
this->WatermarkURL = this->Values[L"WatermarkURL"];
}
}
示例12: StartsText
//---------------------------------------------------------------------------
bool StartsText(const UnicodeString & ASubText, const UnicodeString & AText)
{
return AText.Pos(ASubText) == 1;
}
示例13: StartsStr
bool StartsStr(const UnicodeString & SubStr, const UnicodeString & Str)
{
return Str.Pos(SubStr) == 1;
}
示例14: AnsiPos
intptr_t AnsiPos(const UnicodeString & Str, wchar_t Ch)
{
intptr_t Result = Str.Pos(Ch);
return Result;
}
示例15: Pos
intptr_t Pos(const UnicodeString & Str, const UnicodeString & Substr)
{
intptr_t Result = Str.Pos(Substr.c_str());
return Result;
}