本文整理汇总了C++中AnsiString::Trim方法的典型用法代码示例。如果您正苦于以下问题:C++ AnsiString::Trim方法的具体用法?C++ AnsiString::Trim怎么用?C++ AnsiString::Trim使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnsiString
的用法示例。
在下文中一共展示了AnsiString::Trim方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StringToTokiensA
//---------------------------------------------------------------------------
void StringToTokiensA( AnsiString Words, AnsiString Dlmtr, TStrings *Making )
{
AnsiString Work = Words.Trim();
int spos;
while ((spos = Work.AnsiPos(Dlmtr)) != 0) {
Making->Add(Work.SubString( 1, spos-1));
Work = Work.SubString( spos+1, Work.Length() - spos);
Work = Work.Trim();
} // while
if (Work != "")
Making->Add(Work);
}
示例2: GetProbalityValue
//---------------------------------------------------------------------------
bool GetProbalityValue(AnsiString S, double &dRet, AnsiString &strErr)
{
try
{
AnsiString strComa(0.1);
for(int i=0; i< S.Length(); i++)
{
if(S[i+1] == ',' || S[i+1] == '.')
S[i+1] = strComa[1+1];
}
S = S.Trim();
dRet = S.ToDouble();
if( dRet < 0)
{
strErr = "«начение не должно быть отрицательным '" + S + "'";
return false;
}
}
catch(EConvertError *EC)
{
strErr = "¬ведено неправильное чиcловое значение '" + S + "'";
return false;
}
return true;
}
示例3: if
//---------------------------------------------------------------------------
TStringList* StringToTok2( AnsiString Words,
AnsiString Dlmtr1, AnsiString Dlmtr2 )
{
AnsiString Work = Words.Trim();
int spos;
TStringList *Making = new TStringList;
int spos1 = Work.AnsiPos(Dlmtr1);
int spos2 = Work.AnsiPos(Dlmtr2);
while (spos1 || spos2) {
// int spos = 0;
if (!spos1 && spos2) spos = spos2;
else if (!spos2 && spos1) spos = spos1;
else spos = (spos1 < spos2) ? spos1 : spos2;
Making->Add(Work.SubString( 1, spos-1));
Work = Work.SubString( spos+1, Work.Length() - spos);
Work = Work.Trim();
spos1 = Work.AnsiPos(Dlmtr1);
spos2 = Work.AnsiPos(Dlmtr2);
} // while
if (Work != "")
Making->Add(Work);
return Making;
}
示例4: SetDisplayLabels
//---------------------------------------------------------------------------
void SetDisplayLabels(TIBQuery * query, TcxGridDBDataController * DataController, AnsiString str)
{
if(!IsConnected())
return;
int last_index = 1;
int count = 0;
AnsiString item;
int length = str.Length();
for(int i = 1;i<=length; i++)
{
if(str[i] == ',' || i == length )
{
int len = i-last_index;
if(i == length)
len = i-last_index+1;
item = str.SubString(last_index, len);
last_index = i+1;
if(count <= query->FieldList->Count-1)
query->FieldList->Fields[count]->DisplayLabel = item;
item = item.Trim();
if(item == "false")
query->FieldList->Fields[count]->Visible = false;
count ++;
}
}
if(query->Active && DataController->ItemCount == 0)
DataController->CreateAllItems();
}
示例5: _GetItem
LPCSTR _GetItem(LPCSTR src, int index, AnsiString& dst, char separator, LPCSTR def, bool trim)
{
LPCSTR ptr;
ptr = _SetPos(src, index, separator);
if (ptr) _CopyVal(ptr, dst, separator);
else dst = def;
if (trim) dst = dst.Trim();
return dst.c_str();
}
示例6: FetchModuleLine
//---------------------------------------------------------------------------
AnsiString TRsyncConfigAdapter::FetchModuleLine(AnsiString oneLine){
oneLine = oneLine.Trim();
if(oneLine.Length() < 3){
return "";
}
if(oneLine[1] == '[' && oneLine[oneLine.Length()] == ']'){
return oneLine.SubString(2, oneLine.Length() - 2);
}
return "";
}
示例7: values
AnsiString
RelaxedCanonicalization::CanonicalizeHeaderName(AnsiString name)
{
/*
Unfold all header field continuation lines as described in
[RFC2822]; in particular, lines with terminators embedded in
continued header field values (that is, CRLF sequences followed by
WSP) MUST be interpreted without the CRLF. Implementations MUST
NOT remove the CRLF at the end of the header field value.
*/
name.ToLower();
name.Trim();
return name;
}
示例8: StringToTokiens
//---------------------------------------------------------------------------
TStringList* StringToTokiens( AnsiString Words, AnsiString Dlmtr )
{
AnsiString Work = Words.Trim();
int spos;
TStringList *Making = new TStringList;
while ((spos = Work.AnsiPos(Dlmtr)) != 0) {
Making->Add(Work.SubString( 1, spos-1));
Work = Work.SubString( spos+1, Work.Length() - spos);
Work = Work.Trim();
} // while
if (Work != "")
Making->Add(Work);
return Making;
}
示例9: ParseNameValue
//---------------------------------------------------------------------------
bool TRsyncConfigAdapter::ParseNameValue(AnsiString input,
AnsiString& name, AnsiString& value){
input = input.Trim();
if(input == "") return false;
if(input[1] == '#') return false;
int pos = input.Pos("=");
if(pos == 0) return false;
name = input.SubString(1, pos - 1).Trim();
value = input.SubString(pos + 1, input.Length()).Trim();
return true;
}
示例10: ExeCommands
//---------------------------------------------------------------------------
//
//---------------------------------------------------------------------------
int TBLServiceImpl::ExeCommands(AnsiString asEnterpriseCode,AnsiString asPath,
AnsiString asParams,AnsiString &asResults,AnsiString &asMessage)
{
AnsiString lsResult="";
int lResult = 1;
bool lCompress = !asMessage.IsEmpty();
try
{
AnsiString lsParams;
if(asEnterpriseCode.Trim() =="")
{
asResults = ASWSMarket->AvailableEnterprises;
return 1;
}
if(lCompress)
lsParams = PCTools::DeCompressStrForWS(asParams);
else
lsParams = asParams;
BLInvoker *lInvoker = ASWSMarket->Enterprises[asEnterpriseCode]->Invoker[ttWS][asPath];
if(lInvoker) {
lInvoker->ExecuteCommands(lsParams,lsResult);
}else
throw Exception("无法找到调用对象");
if(lCompress)
asResults = PCTools::CompressStrForWS(lsResult);
else
asResults = lsResult;
}
catch(Exception &E)
{
lResult = -1;
asMessage = E.Message;
if(lCompress)
asResults = PCTools::CompressStrForWS(lsResult);
else
asResults = lsResult;
}
return lResult;
}
示例11: AddANewModule
//---------------------------------------------------------------------------
void TRsyncConfigAdapter::AddANewModule(AnsiString moduleName){
AnsiString fixedName;
moduleName = moduleName.Trim();
for(int i = 1; i <= moduleName.Length(); i++){
if( isalnum(moduleName[i]) ){
fixedName += moduleName[i];
}
}
TModuleHolder* currentModule = new TModuleHolder();
currentModule->moduleName = fixedName;
currentModule->nvp->Add("");
currentModule->nvp->Add(" path = ");
currentModule->nvp->Add(" comment = ");
currentModule->nvp->Add(" read only = false");
currentModule->nvp->Add(" auth users = ");
currentModule->nvp->Add(" secrets file = ");
currentModule->nvp->Add("");
modules->Add(currentModule);
}
示例12: sizeof
int AuthClientUser::ClientProcessThread(SingleThread * self)
{
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
int timeout = SOCKET_TIMEOUT;
setsockopt(m_ClientSocket, SOL_SOCKET, SO_RCVTIMEO,(char*)&timeout, sizeof(timeout));
vector<BYTE> output;
//1. Auth
if(!this->SocketReadBuff(sizeof(tagCClientAuth), &output))
{
SocketReadError("tagCClientAuth SocketReadBuff Error");
return -1;
}
tagCClientAuth *clietAuth = (tagCClientAuth *)&output[0];
clietAuth->UserName[sizeof(clietAuth->UserName)-1] = '\0';
m_UserName = clietAuth->UserName;
m_UserName = m_UserName.LowerCase();
m_UserName = m_UserName.Trim();
string input_username = clietAuth->UserName;
SendLogMessage(FormatStr(GBText("用户[%s]开始验证..."), m_UserName));
m_Build = clietAuth->Build;
BigNumber A, s, B, K, M2;
A.SetBinary(clietAuth->A, sizeof(clietAuth->A));
m_IsChargeProcess = clietAuth->IsChargeProcess;
if(!m_SRP6Server.CalcKey(input_username, input_username, A, &s, &B, &K))
{
SendLogMessage("错误(1)");
SocketReadError("CalcKey Error");
return -1;
}
tagSClientAuth sendAuth;
memcpy(sendAuth.s, s.AsByteArray(), sizeof(sendAuth.s));
memcpy(sendAuth.B, B.AsByteArray(), sizeof(sendAuth.B));
if(!this->SendAuthMessage((BYTE *)&sendAuth, sizeof(sendAuth)))
{
SocketReadError("tagSClientAuth SocketSend Error");
return -1;
}
//2. Auth Check
if(!this->SocketReadBuff(sizeof(tagCAuthCheck), &output))
{
SocketReadError("tagCAuthCheck SocketReadBuff Error");
return -1;
}
tagCAuthCheck *clientAuthCheck = (tagCAuthCheck *)&output[0];
if(!m_SRP6Server.CheckClientAuth(input_username, clientAuthCheck->M, &M2))
{
SendLogMessage("错误(2)");
SocketReadError("Auth Check Error");
return -1;
}
tagSAuthCheck sendAuthCheck;
memcpy(sendAuthCheck.M2, M2.AsByteArray(), sizeof(sendAuthCheck.M2));
if(!this->SendAuthMessage((BYTE *)&sendAuthCheck, sizeof(sendAuthCheck)))
{
SocketReadError("tagSAuthCheck SocketSend Error");
return -1;
}
m_AuthCrypt.Init(&K, WOWWGUserServerEncryptionKey, WOWWGUserServerDecryptionKey);
vector<String> outputMsg;
if(!CheckUserCanLogin(&outputMsg))
{
for(DWORD i=0; i<outputMsg.size(); i++)
{
SendLogMessage(outputMsg[i]);
}
SocketReadError(FormatStr("[RefuseLogin]:%s", m_RefuseLoginReason));
return -1;
}
for(DWORD i=0; i<outputMsg.size(); i++)
{
SendLogMessage(outputMsg[i]);
}
// SendLogMessage(FormatStr(GBText("用户[%s]验证成功!"), m_UserName));
TDateTime expTime;
if(m_IsChargeProcess)
{
//充值
BYTE len = 0;
if(!this->SocketReadBYTE(&len))
{
SendLogMessage("错误(17)");
SocketReadError("Charge CardNo Read Len Error");
return -1;
}
if(!this->SocketReadBuff(len, &output))
{
SendLogMessage("错误(14)");
SocketReadError("Charge CardNo Read Error");
return -1;
}
AnsiString cardNo = AnsiString((char *)&output[0], len);
cardNo = cardNo.Trim();
cardNo = cardNo.UpperCase();
outputMsg.clear();
if(!Charge(m_ADOQuery, m_UserName, cardNo, &outputMsg))
{
//.........这里部分代码省略.........
示例13: ListaExterna
//---------------------------------------------------------------------------
void __fastcall TDM::ListaExterna(PHDataSource *DS, PHTable *Tabela, AnsiString CampoOrig, short Elemento,
AnsiString CampoConsul, short Sistema)
{
AnsiString Codigo = "";
AnsiString Chave;
AnsiString Diretorio;
AnsiString NomeSistema;
if(Sistema)
{
Diretorio = DadosEmpresa(EMPRESAS_LOCALSCPH,vg.EmpresaAtual,0);
NomeSistema = "SCPH";
}
else
{
Diretorio = DadosEmpresa(EMPRESAS_LOCALEFPH,vg.EmpresaAtual,0);
NomeSistema = "EFPH";
}
Diretorio = IncludeTrailingBackslash(Diretorio);
if(Diretorio != "")
{
PHDataSource *_PHDS1;
try
{
_PHDS1 = new PHDataSource(NULL);
_PHDS1->Name = "DSListaExterna";
_PHDS1->Tabela = Tabela;
if(_PHDS1->Tabela->DiretorioTipo == tdPrincipal)
{
Diretorio = DiretorioPrincipal(Diretorio);
}
_PHDS1->DiretorioTipo = tdsExplicito;
_PHDS1->Diretorio = Diretorio;
TLista *L1 = new TLista(this);
try
{
L1->Caption = "Lista: " + _PHDS1->Tabela->NomeOpcao;
L1->PHDS->Tabela = _PHDS1->Tabela;
L1->PHDS->DiretorioTipo = _PHDS1->DiretorioTipo;
L1->PHDS->Diretorio = _PHDS1->Diretorio;
L1->PHDS->IndiceNome = _PHDS1->Tabela->IndiceConsulta;
L1->PHDS->FiltrVis = true;
L1->PHDS->FiltroExpr = _PHDS1->FiltroExpr;
L1->PHDS->Filtrado = _PHDS1->Filtrado;
L1->PHDS->FiltrVis = true;
L1->PHDS->DestaqueExpr = _PHDS1->DestaqueExpr;
L1->PHDS->Destacado = _PHDS1->Destacado;
L1->PHDS->DiaNomeArq = _PHDS1->DiaNomeArq;
L1->PHDS->MesNomeArq = _PHDS1->MesNomeArq;
L1->PHDS->AnoNomeArq = _PHDS1->AnoNomeArq;
if(_PHDS1->OnFiltro)
{
L1->PHDS->OnFiltro = _PHDS1->OnFiltro;
}
L1->PHDS->Open(true);
int CR = L1->PHDS->CountReg() + 1;
if(CR >= 2)
{
L1->PHGrid1->RowCount = CR;
}
else
{
throw Exception("Não foi possível montar Lista para Consulta. Verifique o 'Local " +
NomeSistema +
"' no Cadastro de Empresas.");
}
L1->PHGrid1->AjustaColunas(0);
L1->PHGrid1->Row = 1;
Chave = DS->GT(CampoOrig,Elemento);
if(Chave.Trim() != "")
{
L1->PHDS->BuscaKeyBD(CampoConsul,Chave,true,true);
L1->PHGrid1->Row = L1->PHDS->Ponteiro + 1;
}
L1->ShowModal();
if(L1->Retorno)
{
Codigo = L1->PHDS->GV(CampoConsul);
if(Codigo.Trim() != "")
{
DS->Edit();
DS->SV(CampoOrig,Elemento,Codigo);
}
}
}
__finally
{
L1->PHDS->Close();
if(L1)
{
delete L1;
}
//.........这里部分代码省略.........
示例14: ExeCommand
//---------------------------------------------------------------------------
//表现端事件响应
//---------------------------------------------------------------------------
void __fastcall ASScriptSvr::ExeCommand()
{
AnsiString lsERI = fCommand->ERI;
AnsiString lsAction = fCommand->Action;
AnsiString lsVerb = fCommand->Params["VERB"];
AnsiString lsID = fCommand->IDList->Strings[0],lsSubID="";
if(lsID.Pos(".") > 0 )
{
lsID = lsID.SubString(1,lsID.Pos(".") -1);
lsSubID = lsID.SubString(lsID.Pos(".") +1 ,lsID.Length() - lsID.Pos(".") );
}
PCAttributeDef *lAttDef = Enterprise->AttDefs[lsERI];
PCActionDef *lActionDef = NULL;
if(lsAction.Trim() != "")
lActionDef = lAttDef->ActionDef[lsAction];
PCPtr<PCScripts> lScripts;
_di_IXMLNode lScriptNode;
if(fCommand->isSameVerb("BeforePrCMD"))
{
lScriptNode = lAttDef->GetPSBefScripts(lsVerb);
if(lScriptNode)
{
lScripts = DBConnection->CreateScript(lsERI,lScriptNode);
lScripts->Params->Values["EntityID"] = lsID;
lScripts->Params->Values["SubEntityID"] = lsSubID;
if(lScripts->Run()<0) throw Exception("条件不满足:" + lScripts->Message);
}
if(lActionDef) {
lScriptNode = lActionDef->GetPSBefScripts(lsVerb);
if(lScriptNode)
{
lScripts = DBConnection->CreateScript(lsERI,lScriptNode);
lScripts->Params->Values["EntityID"] = lsID;
lScripts->Params->Values["SubEntityID"] = lsSubID;
if(lScripts->Run()<0) throw Exception("条件不满足:" + lScripts->Message);
}
}
}
else if(fCommand->isSameVerb("AfterPrCMD"))
{
lScriptNode = lAttDef->GetPSAftScripts(lsVerb);
if(lScriptNode)
{
lScripts = DBConnection->CreateScript(lsERI,lScriptNode);
lScripts->Params->Values["EntityID"] = lsID;
lScripts->Params->Values["SubEntityID"] = lsSubID;
if(lScripts->Run()<0) throw Exception("无法完成操作:" + lScripts->Message);
}
if(lActionDef) {
lScriptNode = lActionDef->GetPSAftScripts(lsVerb);
if(lScriptNode)
{
lScripts = DBConnection->CreateScript(lsERI,lScriptNode);
lScripts->Params->Values["EntityID"] = lsID;
lScripts->Params->Values["SubEntityID"] = lsSubID;
if(lScripts->Run()<0) throw Exception("无法完成操作:" + lScripts->Message);
}
}
}
else
throw Exception("错误服务命令,脚本对象");
}
示例15: dlgForced
//---------------------------------------------------------------------------
bool TGJVEditFrame::dlgForced()
{
std::auto_ptr <TForceLogDlg> ForceDlg( new TForceLogDlg( this ) );
getScreenEntry();
valid( cmCheckValid ); // This adds errors to the MAIN dialog error list, not our own
ErrorList &errs = MinosParameters::getMinosParameters() ->getErrorList();
for ( ErrorIterator i = errs.begin(); i != errs.end(); i++ )
{
ForceDlg->ErrList->Items->Add( ( *i ) ->errStr.c_str() );
}
ForceDlg->ErrList->ItemIndex = 0;
int s = screenContact.contactScore;
if ( s < 0 )
s = 0;
AnsiString temp;
temp.printf( "%d", s );
ForceDlg->ScoreIl->Text = temp;
ForceDlg->CheckBox1->Checked = screenContact.contactFlags & TO_BE_ENTERED;
ForceDlg->CheckBox2->Checked = screenContact.contactFlags & VALID_DUPLICATE;
ForceDlg->CheckBox3->Checked = screenContact.contactFlags & MANUAL_SCORE;
ForceDlg->CheckBox4->Checked = screenContact.contactFlags & NON_SCORING;
ForceDlg->CheckBox5->Checked = screenContact.contactFlags & DONT_PRINT;
ForceDlg->CheckBox6->Checked = screenContact.contactFlags & COUNTRY_FORCED;
ForceDlg->CheckBox7->Checked = screenContact.contactFlags & VALID_DISTRICT;
ForceDlg->CheckBox8->Checked = screenContact.contactFlags & XBAND;
if ( MinosParameters::getMinosParameters() ->isErrSet( ERR_12 ) ||
( screenContact.contactFlags & ( NON_SCORING | MANUAL_SCORE | DONT_PRINT | VALID_DUPLICATE | TO_BE_ENTERED | XBAND ) ) )
{
// set nothing! DUPs are dealt with!
}
else
if ( errs.size() != 0 ) // no errors -> OK
ForceDlg->CheckBox4->Checked = screenContact.contactFlags | NON_SCORING;
if ( screenContact.contactFlags & COUNTRY_FORCED )
{
ForceDlg->CtryMultIl->Text = screenContact.forcedMult.c_str();
}
else
if ( contest->countryMult.getValue() && screenContact.ctryMult )
{
ForceDlg->CtryMultIl->Text = screenContact.ctryMult->basePrefix.c_str();
}
bool tryagain = true;
int res = mrCancel;
while ( tryagain && ( res = ForceDlg->ShowModal() ) == mrOk )
{
if ( contest->countryMult.getValue() )
{
temp = ForceDlg->CtryMultIl->Text;
}
else
break;
if ( !ForceDlg->CheckBox6->Checked )
{
tryagain = false;
screenContact.contactFlags &= ~ COUNTRY_FORCED;
screenContact.ctryMult = 0;
screenContact.forcedMult = "";
break;
}
temp = temp.Trim();
CountryEntry *ctryMult = MultLists::getMultLists() ->getCtryForPrefix( temp.c_str() );
if ( ctryMult )
{
tryagain = false;
if ( screenContact.ctryMult != ctryMult )
{
screenContact.ctryMult = ctryMult;
screenContact.contactFlags |= COUNTRY_FORCED;
screenContact.forcedMult = temp.c_str();
}
}
else
{
if ( MessageBox( Handle, "Country not in CTY.DAT. Leave for now?", "Force log contact", MB_ICONQUESTION | MB_OKCANCEL ) == mbOK )
{
tryagain = false;
screenContact.contactFlags &= ~COUNTRY_FORCED;
screenContact.forcedMult = "";
}
}
}
if ( res == mrOk )
{
// save contact...
screenContact.contactFlags |= FORCE_LOG;
// here read it all off the dialog
//.........这里部分代码省略.........