当前位置: 首页>>代码示例>>C++>>正文


C++ String::Compare方法代码示例

本文整理汇总了C++中String::Compare方法的典型用法代码示例。如果您正苦于以下问题:C++ String::Compare方法的具体用法?C++ String::Compare怎么用?C++ String::Compare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在String的用法示例。


在下文中一共展示了String::Compare方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: StringToMode

LegacySymmetricProvider::Mode LegacySymmetricProvider::StringToMode(
    const String& Mode)
{
    if (Mode.Compare("aes-128-cbc"))
        return LegacySymmetricProvider::AES_128_CBC;
    if (Mode.Compare("aes-256-cbc"))
        return LegacySymmetricProvider::AES_256_CBC;
    if (Mode.Compare("aes-256-ecb"))
        return LegacySymmetricProvider::AES_256_ECB;
    if (Mode.Compare("aes-128-gcm"))
        return LegacySymmetricProvider::AES_128_GCM;
    if (Mode.Compare("aes-256-gcm"))
        return LegacySymmetricProvider::AES_256_GCM;
    return LegacySymmetricProvider::ERROR_MODE;
}
开发者ID:Open-Transactions,项目名称:opentxs,代码行数:15,代码来源:LegacySymmetricProvider.cpp

示例2: if

VcfInd::VcfInd(const String& indID, const String& famID, const String& fatID, const String& motID, const String& gender) {
  sIndID = indID;
  sFamID = famID;
  sFatID = (famID.Length() == 0) ? "0" : famID;
  sMotID = (motID.Length() == 0) ? "0" : motID;
  if ( gender.Compare("1") == 0 ) {
    this->gender = MALE;
  }
  else if ( gender.Compare("2") == 0 ) {
    this->gender = FEMALE;
  }
  else {
    this->gender = UNKNOWN;
  }
}
开发者ID:amarawi,项目名称:gotcloud,代码行数:15,代码来源:VcfFile.cpp

示例3: Check_bool

bool Settings::Check_bool(const String& strSection, const String& strKey,
                            bool& out_bResult, bool& out_bKeyExist) const
{
    if (!strSection.Exists()) {
        otErr << __FUNCTION__ << ": Error: "
              << "strSection"
              << " is Empty!\n";
        OT_FAIL;
    }
    if (strSection.Compare("")) {
        otErr << __FUNCTION__ << ": Error: "
              << "strSection"
              << " is Blank!\n";
        OT_FAIL;
    }

    if (!strKey.Exists()) {
        otErr << __FUNCTION__ << ": Error: "
              << "strKey"
              << " is Empty!\n";
        OT_FAIL;
    }
    if (strKey.Compare("")) {
        otErr << __FUNCTION__ << ": Error: "
              << "strKey"
              << " is Blank!\n";
        OT_FAIL;
    }

    const char* szVar =
        pvt->iniSimple.GetValue(strSection.Get(), strKey.Get(), nullptr);
    String strVar(szVar);

    if (strVar.Exists() &&
        (strVar.Compare("false") || strVar.Compare("true"))) {
        out_bKeyExist = true;
        if (strVar.Compare("true"))
            out_bResult = true;
        else
            out_bResult = false;
    }
    else {
        out_bKeyExist = false;
        out_bResult = false;
    }

    return true;
}
开发者ID:bitcredit-currency,项目名称:opentxs,代码行数:48,代码来源:Settings.cpp

示例4: ProcessXMLNode

int32_t OTMasterkey::ProcessXMLNode(irr::io::IrrXMLReader*& xml)
{
    int32_t nReturnVal = ot_super::ProcessXMLNode(xml);

    // Here we call the parent class first.
    // If the node is found there, or there is some error,
    // then we just return either way.  But if it comes back
    // as '0', then nothing happened, and we'll continue executing.
    //
    // -- Note you can choose not to call the parent if
    // you don't want to use any of those xml tags.
    // As I do in the case of OTAccount.
    //
    if (0 != nReturnVal) return nReturnVal;
    // else it was 0 (continue...)

    const String strNodeName(xml->getNodeName());

    if (strNodeName.Compare("masterCredential")) {
        m_strNymID = xml->getAttributeValue("nymID");

        m_strMasterCredID.Release();

        otWarn << "Loading masterCredential...\n";

        nReturnVal = 1;
    }

    return nReturnVal;
}
开发者ID:yamamushi,项目名称:opentxs,代码行数:30,代码来源:OTMasterkey.cpp

示例5: LogChange_str

bool Settings::LogChange_str(const String& strSection, const String& strKey,
                               const String& strValue)
{
    if (!strSection.Exists()) {
        otErr << __FUNCTION__ << ": Error: "
              << "strSection"
              << " is Empty!\n";
        OT_FAIL;
    }
    if (!strKey.Exists()) {
        otErr << __FUNCTION__ << ": Error: "
              << "strKey"
              << " is Empty!\n";
        OT_FAIL;
    }

    const char* const szValue = (strValue.Exists() && !strValue.Compare(""))
                                    ? strValue.Get()
                                    : "nullptr";

    String strCategory, strOption;
    if (!Log::StringFill(strCategory, strSection.Get(), 12)) return false;
    if (!Log::StringFill(strOption, strKey.Get(), 30, " to:")) return false;

    otWarn << "Setting " << strCategory << " " << strOption << " " << szValue
           << " \n";
    return true;
}
开发者ID:bitcredit-currency,项目名称:opentxs,代码行数:28,代码来源:Settings.cpp

示例6: CheckSetSection

bool Settings::CheckSetSection(const String& strSection,
                                 const String& strComment,
                                 bool& out_bIsNewSection)
{
    if (!strSection.Exists()) {
        otErr << __FUNCTION__ << ": Error: "
              << "strSection"
              << " is Empty!\n";
        OT_FAIL;
    }
    if (!strComment.Exists()) {
        otErr << __FUNCTION__ << ": Error: "
              << "strComment"
              << " is Empty!\n";
        OT_FAIL;
    }

    const char* const szComment =
        (strComment.Exists() && !strComment.Compare("")) ? strComment.Get()
                                                         : nullptr;

    const int64_t lSectionSize =
        pvt->iniSimple.GetSectionSize(strSection.Get());

    if (1 > lSectionSize) {
        out_bIsNewSection = true;
        SI_Error rc = pvt->iniSimple.SetValue(strSection.Get(), nullptr,
                                              nullptr, szComment, false);
        if (0 > rc) return false;
    }
    else {
        out_bIsNewSection = false;
    }
    return true;
}
开发者ID:bitcredit-currency,项目名称:opentxs,代码行数:35,代码来源:Settings.cpp

示例7: getSampleIndex

int VcfFile::getSampleIndex(const String& name) {
  for(int i=0; i < (int)vpVcfInds.size(); ++i) {
    if ( name.Compare(vpVcfInds[i]->sIndID) == 0 ) {
      return i;
    }
  }
  return -1;
}
开发者ID:amarawi,项目名称:gotcloud,代码行数:8,代码来源:VcfFile.cpp

示例8: setQual

void VcfMarker::setQual(const String& s) {
  if ( s.Compare(".") == 0 ) {
    fQual = -1;
  }
  else {
    fQual = atof(s.c_str());
  }
}
开发者ID:amarawi,项目名称:gotcloud,代码行数:8,代码来源:VcfFile.cpp

示例9: GetOriginTypeFromString

originType OTTransactionType::GetOriginTypeFromString(const String& strType)
{
    originType theType = originType::origin_error_state;

    if (strType.Compare("not_applicable"))
        theType = originType::not_applicable;
    else if (strType.Compare("origin_market_offer"))
        theType = originType::origin_market_offer;
    else if (strType.Compare("origin_payment_plan"))
        theType = originType::origin_payment_plan;
    else if (strType.Compare("origin_smart_contract"))
        theType = originType::origin_smart_contract;
    else if (strType.Compare("origin_pay_dividend"))
        theType = originType::origin_pay_dividend;
    else
        theType = originType::origin_error_state;

    return theType;
}
开发者ID:Open-Transactions,项目名称:opentxs,代码行数:19,代码来源:OTTransactionType.cpp

示例10: CheckSet_str

bool Settings::CheckSet_str(const String& strSection, const String& strKey,
                              const String& strDefault, std::string& out_strResult,
                              bool& out_bIsNew, const String& strComment)
{
    if (!strSection.Exists()) {
        otErr << __FUNCTION__ << ": Error: "
              << "strSection"
              << " is Empty!\n";
        OT_FAIL;
    }
    if (!strKey.Exists()) {
        otErr << __FUNCTION__ << ": Error: "
              << "strKey"
              << " is Empty!\n";
        OT_FAIL;
    }

    const char* const szDefault =
        (strDefault.Exists() && !strDefault.Compare("")) ? strDefault.Get()
                                                         : nullptr;

    String strTempResult;
    bool bKeyExist;
    if (!Check_str(strSection, strKey, strTempResult, bKeyExist)) return false;

    if (bKeyExist) {
        // Already have a key, lets use it's value.
        out_bIsNew = false;
        out_strResult = strTempResult.Get();
        return true;
    }
    else {
        bool bNewKeyCheck;
        if (!Set_str(strSection, strKey, strDefault, bNewKeyCheck, strComment))
            return false;

        if (nullptr == szDefault) // The Default is to have no key.
        {
            // Success
            out_bIsNew = false;
            out_strResult = "";
            return true;
        }

        if (bNewKeyCheck) {
            // Success
            out_bIsNew = true;
            out_strResult = strDefault.Get();
            return true;
        }
    }

    // If we get here, error!
    OT_FAIL;
}
开发者ID:bitcredit-currency,项目名称:opentxs,代码行数:55,代码来源:Settings.cpp

示例11: protocols

   void
   Base64Tester::Test()
   {
      String s;

      AnsiString input = "Test";
      s = Base64::Encode(input.GetBuffer(), input.GetLength());
      if (s.Compare(_T("VGVzdA==")) != 0)
         throw;

      input = "Test test test test test test test!!!!";
      s = Base64::Encode(input, input.GetLength());
      if (s.Compare(_T("VGVzdCB0ZXN0IHRlc3QgdGVzdCB0ZXN0IHRlc3QgdGVzdCEhISE=")) != 0)
         throw;

      input = "hMailServer is a free e-mail server for Microsoft Windows. It's used by Internet service providers, companies, governments, schools and enthusiasts in all parts of the world. It supports the common e-mail protocols (IMAP, SMTP and POP3) and can easily be integrated with many existing web mail systems. It has flexible score-based spam protection and can attach to your virus scanner to scan all incoming and outgoing email.";
      s = Base64::Encode(input, input.GetLength());
      if (s.Compare(_T("aE1haWxTZXJ2ZXIgaXMgYSBmcmVlIGUtbWFpbCBzZXJ2ZXIgZm9yIE1pY3Jvc29mdCBXaW5kb3dzLiBJdCdzIHVzZWQgYnkgSW50ZXJuZXQgc2VydmljZSBwcm92aWRlcnMsIGNvbXBhbmllcywgZ292ZXJubWVudHMsIHNjaG9vbHMgYW5kIGVudGh1c2lhc3RzIGluIGFsbCBwYXJ0cyBvZiB0aGUgd29ybGQuIEl0IHN1cHBvcnRzIHRoZSBjb21tb24gZS1tYWlsIHByb3RvY29scyAoSU1BUCwgU01UUCBhbmQgUE9QMykgYW5kIGNhbiBlYXNpbHkgYmUgaW50ZWdyYXRlZCB3aXRoIG1hbnkgZXhpc3Rpbmcgd2ViIG1haWwgc3lzdGVtcy4gSXQgaGFzIGZsZXhpYmxlIHNjb3JlLWJhc2VkIHNwYW0gcHJvdGVjdGlvbiBhbmQgY2FuIGF0dGFjaCB0byB5b3VyIHZpcnVzIHNjYW5uZXIgdG8gc2NhbiBhbGwgaW5jb21pbmcgYW5kIG91dGdvaW5nIGVtYWlsLg==")) != 0)
         throw;

      input = "VGVzdA==";
      s = Base64::Decode(input, input.GetLength());
      if (s.Compare(_T("Test")) != 0)
         throw;

      input = "VGVzdCB0ZXN0IHRlc3QgdGVzdCB0ZXN0IHRlc3QgdGVzdCEhISE=";
      s = Base64::Decode(input, input.GetLength());
      if (s.Compare(_T("Test test test test test test test!!!!")) != 0)
         throw;

      input = "aE1haWxTZXJ2ZXIgaXMgYSBmcmVlIGUtbWFpbCBzZXJ2ZXIgZm9yIE1pY3Jvc29mdCBXaW5kb3dzLiBJdCdzIHVzZWQgYnkgSW50ZXJuZXQgc2VydmljZSBwcm92aWRlcnMsIGNvbXBhbmllcywgZ292ZXJubWVudHMsIHNjaG9vbHMgYW5kIGVudGh1c2lhc3RzIGluIGFsbCBwYXJ0cyBvZiB0aGUgd29ybGQuIEl0IHN1cHBvcnRzIHRoZSBjb21tb24gZS1tYWlsIHByb3RvY29scyAoSU1BUCwgU01UUCBhbmQgUE9QMykgYW5kIGNhbiBlYXNpbHkgYmUgaW50ZWdyYXRlZCB3aXRoIG1hbnkgZXhpc3Rpbmcgd2ViIG1haWwgc3lzdGVtcy4gSXQgaGFzIGZsZXhpYmxlIHNjb3JlLWJhc2VkIHNwYW0gcHJvdGVjdGlvbiBhbmQgY2FuIGF0dGFjaCB0byB5b3VyIHZpcnVzIHNjYW5uZXIgdG8gc2NhbiBhbGwgaW5jb21pbmcgYW5kIG91dGdvaW5nIGVtYWlsLg==";
      s = Base64::Decode(input, input.GetLength());
      if (s.Compare(_T("hMailServer is a free e-mail server for Microsoft Windows. It's used by Internet service providers, companies, governments, schools and enthusiasts in all parts of the world. It supports the common e-mail protocols (IMAP, SMTP and POP3) and can easily be integrated with many existing web mail systems. It has flexible score-based spam protection and can attach to your virus scanner to scan all incoming and outgoing email.")) != 0)
         throw;
   }
开发者ID:bogri5520,项目名称:hMailServer,代码行数:35,代码来源:Base64.cpp

示例12: InsertAlpha

void InsertAlpha(StringVector &container, const String &value)
{
    if (container.Find(value) != container.End())
        return;
    for(auto iter = container.Begin(); iter != container.End(); ++iter)
    {
        if (value.Compare((*iter), false) < 0)
        {
            container.Insert(iter, value);
            return;
        }
    }
    container.Push(value);
}
开发者ID:aoighost,项目名称:tundra-urho3d,代码行数:14,代码来源:CoreDebugHuds.cpp

示例13: VcfFileException

int VcfHelper::chromName2Num(const String & chr) {
  int n = atoi(chr.c_str());
  if ( n > 0 ) { return n; }
  else {
    String s = chr;
    if ( s.Left(3).Compare("chr") == 0 ) {
      n = atoi(s.SubStr(3).c_str());
      if ( n > 0 ) { return n; }
      s = s.SubStr(3);
    }
    for(int i=0; i < asChromNames.Length(); ++i) {
      if ( s.Compare(asChromNames[i]) == 0 ) {
	return vnChromNums[i];
      }
    }
  }
  throw VcfFileException("Cannot recognize chromosome %s",chr.c_str());
}
开发者ID:amarawi,项目名称:gotcloud,代码行数:18,代码来源:VcfFile.cpp

示例14: StringToHashType

CryptoHash::HashType CryptoHash::StringToHashType(const String& inputString)
{
    if (inputString.Compare("null"))
        return CryptoHash::NONE;
    else if (inputString.Compare("HASH256"))
        return CryptoHash::HASH256;
    else if (inputString.Compare("HASH160"))
        return CryptoHash::HASH160;
    else if (inputString.Compare("SHA224"))
        return CryptoHash::SHA224;
    else if (inputString.Compare("SHA256"))
        return CryptoHash::SHA256;
    else if (inputString.Compare("SHA384"))
        return CryptoHash::SHA384;
    else if (inputString.Compare("SHA512"))
        return CryptoHash::SHA512;
    return CryptoHash::ERROR;
}
开发者ID:Kodachi75,项目名称:opentxs,代码行数:18,代码来源:CryptoHash.cpp

示例15: GetFirstWarning

String TFrmAlarmDetailList::GetFirstWarning()
{

	String szFirstAlarm;

	String szAlarmCode = grdWarningDetail->Cells[ 1 ][ 1 ];
    String szAlarmName = grdWarningDetail->Cells[ 2 ][ 1 ];

    if( szAlarmCode.Compare( "" ) != 0 )
    {
        szFirstAlarm += "[ " + szAlarmCode + " ]" + " " + szAlarmName;
    }
    else
    {
    	szFirstAlarm = "";
    }

    return szFirstAlarm;

}
开发者ID:japgo,项目名称:mygithub,代码行数:20,代码来源:AlarmDetailScrn.cpp


注:本文中的String::Compare方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。