本文整理汇总了C++中CStdString::FindOneOf方法的典型用法代码示例。如果您正苦于以下问题:C++ CStdString::FindOneOf方法的具体用法?C++ CStdString::FindOneOf怎么用?C++ CStdString::FindOneOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStdString
的用法示例。
在下文中一共展示了CStdString::FindOneOf方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetValueStringFormat
BOOL CObjectEntry::SetValueStringFormat(CStdString strFormattedValue)
{
CMmcDataConversion conversion;
unsigned __int64 uInt64Value(0);
CStdString strValue = _T("");
int iIndex;
BOOL oResult(TRUE);
//Remove leading text
iIndex = strFormattedValue.FindOneOf("0123456789");
if(iIndex != -1) strValue = strFormattedValue.Right(strFormattedValue.GetLength()-iIndex); else strValue = strFormattedValue;
//Check Types
if(conversion.DecUInt64Str2UInt64(strValue, &uInt64Value, FALSE))
{
m_ValueStringFormat = OVF_DEC;
oResult = TRUE;
}
else if(conversion.HexUInt64Str2UInt64(strValue, &uInt64Value, FALSE))
{
m_ValueStringFormat = OVF_HEX;
oResult = TRUE;
}
else
{
m_ValueStringFormat = OVF_DEC;
oResult = FALSE;
}
return oResult;
}
示例2: GetBoolFromToken
const bool CommandLineParser::GetBoolFromToken(CStdString sToken)
{
// Token strings which contain either ':' or '=' and end in one of the 'enabled' strings are considered true.
// All others are considered false.
if( !sToken.IsEmpty() )
{
int iValuePos = sToken.FindOneOf(_T(":="));
if( iValuePos >= 0 )
{
CStdString sValue = DeQuote(sToken.Mid(iValuePos+1));
CStdString sLowercaseValue = sValue.ToLower();
if( (sLowercaseValue == "enabled") ||
(sLowercaseValue == "enable") ||
(sLowercaseValue == "true") ||
(sLowercaseValue == "on") ||
(sLowercaseValue == "1") )
{
return true;
}
}
}
return false;
}
示例3: GetValueFromToken
const CStdString CommandLineParser::GetValueFromToken(CStdString sToken)
{
if (sToken.IsEmpty())
return _T("");
int iValuePos = sToken.FindOneOf(_T(":="));
if (iValuePos==-1)
return _T("");
return DeQuote(sToken.Mid(iValuePos+1));
}
示例4: ReplaceInvalidFileNameChars
CStdString DocProvHelper::ReplaceInvalidFileNameChars(CStdString sString) const
{
while (true)
{
/* TXTEX_IGNORE */ int iPos = sString.FindOneOf(_T(":*?\"&<>|"));
if (iPos==-1)
break;
sString.erase(sString.begin()+iPos);
}
return sString;
}
示例5: GetSwitchKeyFromToken
const CStdString CommandLineParser::GetSwitchKeyFromToken(CStdString sToken)
{
if (sToken.IsEmpty())
return _T("");
sToken.ToLower();
switch (sToken[0])
{
case _T('/'):
case _T('-'):
{
CStdString sSwitch = sToken.Mid(1);
int iValuePos = sSwitch.FindOneOf(_T(":="));
if (iValuePos==-1)
return sSwitch;
return sSwitch.Left(iValuePos);
}
default:
return _T("");
}
}
示例6: SetOption
void COptions::SetOption(int nOptionID, LPCTSTR value, bool save /*=true*/)
{
CStdString str = value;
Init();
switch (nOptionID)
{
case OPTION_SERVERPORT:
case OPTION_TLSPORTS:
{
std::set<int> portSet;
str.TrimLeft(_T(" ,"));
int pos = str.FindOneOf(_T(" ,"));
while (pos != -1)
{
int port = _ttoi(str.Left(pos));
if (port >= 1 && port <= 65535)
portSet.insert(port);
str = str.Mid(pos + 1);
str.TrimLeft(_T(" ,"));
pos = str.FindOneOf(_T(" ,"));
}
if (str != _T(""))
{
int port = _ttoi(str);
if (port >= 1 && port <= 65535)
portSet.insert(port);
}
str = _T("");
for (std::set<int>::const_iterator iter = portSet.begin(); iter != portSet.end(); iter++)
{
CStdString tmp;
tmp.Format(_T("%d "), *iter);
str += tmp;
}
str.TrimRight(' ');
}
break;
case OPTION_WELCOMEMESSAGE:
{
std::vector<CStdString> msgLines;
int oldpos = 0;
str.Replace(_T("\r\n"), _T("\n"));
int pos = str.Find(_T("\n"));
CStdString line;
while (pos != -1)
{
if (pos)
{
line = str.Mid(oldpos, pos - oldpos);
line = line.Left(CONST_WELCOMEMESSAGE_LINESIZE);
line.TrimRight(_T(" "));
if (msgLines.size() || line != _T(""))
msgLines.push_back(line);
}
oldpos = pos + 1;
pos = str.Find(_T("\n"), oldpos);
}
line = str.Mid(oldpos);
if (line != _T(""))
{
line = line.Left(CONST_WELCOMEMESSAGE_LINESIZE);
msgLines.push_back(line);
}
str = _T("");
for (unsigned int i = 0; i < msgLines.size(); i++)
str += msgLines[i] + _T("\r\n");
str.TrimRight(_T("\r\n"));
if (str == _T(""))
{
str = _T("%v");
str += _T("\r\nwritten by Tim Kosse ([email protected])");
str += _T("\r\nPlease visit https://filezilla-project.org/");
}
}
break;
case OPTION_ADMINIPBINDINGS:
{
CStdString sub;
std::list<CStdString> ipBindList;
for (unsigned int i = 0; i<_tcslen(value); i++)
{
TCHAR cur = value[i];
if ((cur < '0' || cur > '9') && cur != '.' && cur != ':')
{
if (sub == _T("") && cur == '*')
{
ipBindList.clear();
ipBindList.push_back(_T("*"));
break;
}
if (sub != _T(""))
{
if (IsIpAddress(sub))
ipBindList.push_back(sub);
sub = _T("");
//.........这里部分代码省略.........