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


C++ nsCString::ReplaceChar方法代码示例

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


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

示例1: SanitizeSampleData

void ImportAddressImpl::SanitizeSampleData( nsCString& val)
{
    // remove any line-feeds...
    val.ReplaceSubstring( "\x0D\x0A", ", ");
    val.ReplaceChar( 13, ',');
    val.ReplaceChar( 10, ',');
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:7,代码来源:nsTextImport.cpp

示例2: GenerateRandomPathName

nsresult GenerateRandomPathName(nsCString& aOutSalt, uint32_t aLength) {
  nsresult rv = GenerateRandomName(aOutSalt, aLength);
  if (NS_FAILED(rv)) return rv;

  // Base64 characters are alphanumeric (a-zA-Z0-9) and '+' and '/', so we need
  // to replace illegal characters -- notably '/'
  aOutSalt.ReplaceChar(FILE_PATH_SEPARATOR FILE_ILLEGAL_CHARACTERS, '_');
  return NS_OK;
}
开发者ID:jld,项目名称:gecko-dev,代码行数:9,代码来源:VideoUtils.cpp

示例3: GetBrowserWindowTitle

void CBrowserView::GetBrowserWindowTitle(nsCString& title)
{
    nsXPIDLString idlStrTitle;
    if(mBaseWindow)
        mBaseWindow->GetTitle(getter_Copies(idlStrTitle));

    title.AssignWithConversion(idlStrTitle);

    // Sanitize the title of all illegal characters
    title.CompressWhitespace();     // Remove whitespace from the ends
    title.StripChars("\\*|:\"><?"); // Strip illegal characters
    title.ReplaceChar('.', L'_');   // Dots become underscores
    title.ReplaceChar('/', L'-');   // Forward slashes become hyphens
}
开发者ID:rhencke,项目名称:mozilla-cvs-history,代码行数:14,代码来源:BrowserView.cpp

示例4:

static
nsresult
Base64urlEncode(const PRUint8* aBytes,
                PRUint32 aNumBytes,
                nsCString& _result)
{
  // SetLength does not set aside space for NULL termination.  PL_Base64Encode
  // will not NULL terminate, however, nsCStrings must be NULL terminated.  As a
  // result, we set the capacity to be one greater than what we need, and the
  // length to our desired length.
  PRUint32 length = (aNumBytes + 2) / 3 * 4; // +2 due to integer math.
  NS_ENSURE_TRUE(_result.SetCapacity(length + 1), NS_ERROR_OUT_OF_MEMORY);
  _result.SetLength(length);
  (void)PL_Base64Encode(reinterpret_cast<const char*>(aBytes), aNumBytes,
                        _result.BeginWriting());

  // base64url encoding is defined in RFC 4648.  It replaces the last two
  // alphabet characters of base64 encoding with '-' and '_' respectively.
  _result.ReplaceChar('+', '-');
  _result.ReplaceChar('/', '_');
  return NS_OK;
}
开发者ID:krellian,项目名称:mozilla-central,代码行数:22,代码来源:Helpers.cpp

示例5: SanitizeSingleLine

void nsTextAddress::SanitizeSingleLine( nsCString& val)
{
    val.ReplaceSubstring( "\x0D\x0A", ", ");
    val.ReplaceChar( 13, ' ');
    val.ReplaceChar( 10, ' ');
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:6,代码来源:nsTextAddress.cpp

示例6: SanitizeValue

void nsEudoraAddress::SanitizeValue( nsCString& val)
{
  val.ReplaceSubstring( "\n", ", ");
  val.ReplaceChar( 13, ',');
  val.ReplaceChar( 10, ',');
}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:6,代码来源:nsEudoraAddress.cpp


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