本文整理汇总了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, ',');
}
示例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;
}
示例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
}
示例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;
}
示例5: SanitizeSingleLine
void nsTextAddress::SanitizeSingleLine( nsCString& val)
{
val.ReplaceSubstring( "\x0D\x0A", ", ");
val.ReplaceChar( 13, ' ');
val.ReplaceChar( 10, ' ');
}
示例6: SanitizeValue
void nsEudoraAddress::SanitizeValue( nsCString& val)
{
val.ReplaceSubstring( "\n", ", ");
val.ReplaceChar( 13, ',');
val.ReplaceChar( 10, ',');
}