本文整理汇总了C++中ToLowerCase函数的典型用法代码示例。如果您正苦于以下问题:C++ ToLowerCase函数的具体用法?C++ ToLowerCase怎么用?C++ ToLowerCase使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ToLowerCase函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ToSentenceCase
void ToSentenceCase(std::wstring& str)
{
if (!str.empty())
{
ToLowerCase(str);
bool isCapped = false;
for (size_t i = 0; i < str.length(); ++i)
{
if (IsEOSPunct(str[i])) isCapped = false;
if (!isCapped && iswalpha(str[i]) != 0)
{
WCHAR* srcAndDest = &str[i];
LCMapString(LOCALE_USER_DEFAULT, LCMAP_UPPERCASE, srcAndDest, 1, srcAndDest, 1);
isCapped = true;
}
}
}
}
示例2: ToLowerCase
void
InternalHeaders::Get(const nsACString& aName, nsCString& aValue, ErrorResult& aRv) const
{
nsAutoCString lowerName;
ToLowerCase(aName, lowerName);
if (IsInvalidName(lowerName, aRv)) {
return;
}
for (uint32_t i = 0; i < mList.Length(); ++i) {
if (lowerName == mList[i].mName) {
aValue = mList[i].mValue;
return;
}
}
// No value found, so return null to content
aValue.SetIsVoid(true);
}
示例3: ToSentenceCase
void ToSentenceCase(std::wstring& str)
{
auto to_upper = [](wchar_t& ch) { ch = std::use_facet<std::ctype<wchar_t>>(std::locale()).toupper(ch); };
if (!str.empty())
{
ToLowerCase(str);
bool isCapped = false;
for (size_t i = 0; i < str.length(); ++i)
{
if (IsEOSPunct(str[i])) isCapped = false;
if (!isCapped && iswalpha(str[i]) != 0)
{
to_upper(str[i]);
isCapped = true;
}
}
}
}
示例4: NS_ASSERTION
void nsColorNames::AddRefTable(void)
{
NS_ASSERTION(!gColorTable, "pre existing array!");
if (!gColorTable) {
gColorTable = new nsStaticCaseInsensitiveNameTable();
if (gColorTable) {
#ifdef DEBUG
{
// let's verify the table...
for (PRUint32 index = 0; index < eColorName_COUNT; ++index) {
nsCAutoString temp1(kColorNames[index]);
nsCAutoString temp2(kColorNames[index]);
ToLowerCase(temp1);
NS_ASSERTION(temp1.Equals(temp2), "upper case char in table");
}
}
#endif
gColorTable->Init(kColorNames, eColorName_COUNT);
}
}
}
示例5: CSP_IsQuotelessKeyword
bool
CSP_IsQuotelessKeyword(const nsAString& aKey)
{
nsString lowerKey = PromiseFlatString(aKey);
ToLowerCase(lowerKey);
static_assert(CSP_LAST_KEYWORD_VALUE ==
(sizeof(CSPStrKeywords) / sizeof(CSPStrKeywords[0])),
"CSP_LAST_KEYWORD_VALUE does not match length of CSPStrKeywords");
nsAutoString keyword;
for (uint32_t i = 0; i < CSP_LAST_KEYWORD_VALUE; i++) {
// skipping the leading ' and trimming the trailing '
keyword.AssignASCII(CSPStrKeywords[i] + 1);
keyword.Trim("'", false, true);
if (lowerKey.Equals(keyword)) {
return true;
}
}
return false;
}
示例6: LOG
nsresult
HttpBaseChannel::ApplyContentConversions()
{
if (!mResponseHead)
return NS_OK;
LOG(("HttpBaseChannel::ApplyContentConversions [this=%p]\n", this));
if (!mApplyConversion) {
LOG(("not applying conversion per mApplyConversion\n"));
return NS_OK;
}
const char *val = mResponseHead->PeekHeader(nsHttp::Content_Encoding);
if (gHttpHandler->IsAcceptableEncoding(val)) {
nsCOMPtr<nsIStreamConverterService> serv;
nsresult rv = gHttpHandler->
GetStreamConverterService(getter_AddRefs(serv));
// we won't fail to load the page just because we couldn't load the
// stream converter service.. carry on..
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIStreamListener> converter;
nsCAutoString from(val);
ToLowerCase(from);
rv = serv->AsyncConvertData(from.get(),
"uncompressed",
mListener,
mListenerContext,
getter_AddRefs(converter));
if (NS_SUCCEEDED(rv)) {
LOG(("converter installed from \'%s\' to \'uncompressed\'\n", val));
mListener = converter;
}
}
} else if (val != nsnull) {
LOG(("Unknown content encoding '%s', ignoring\n", val));
}
return NS_OK;
}
示例7: while
void CISpellAffix::Strip ( char * szText )
{
char * szIterator1 = szText;
char * szIterator2 = szText;
while ( *szIterator1 )
{
if ( !isspace ( (unsigned char) *szIterator1 ) && *szIterator1!='-' )
{
*szIterator2 = *szIterator1;
++szIterator2;
}
++szIterator1;
}
*szIterator2 = '\0';
while ( *szText )
{
*szText = ToLowerCase ( *szText );
++szText;
}
}
示例8: Reset
/**
* Sets a new search, if there's already a search taking place, it's reset.
* @param schTree Vdf tree to look into.
* @param search Search string.
* @param flags Default search is for key case sensitive,
* might be changed by setting:<br><code>
* VDF_MATCH_VALUE </code><br>and<code>
* VDF_IGNORE_CASE</code>
* @param level Level in which search will be valid. When -1 (default)
* all levels match.
*/
void VDFSearch::SetSearch(VDFTree *schTree, char *search, UINT flags, int level)
{
Reset();
searchLevel = level;
searchFlags = flags;
searchTree = schTree;
const UINT startAnchors = 6;
searchStr = new char[strlen(search) + 1];
if(flags & VDF_IGNORE_CASE)
ToLowerCase(search, searchStr);
else
strcpy(searchStr, search);
// start with 6 levels to avoid unnecessary grows
levelCount = startAnchors;
levelAnchor = new VDFNode*[startAnchors];
memset(levelAnchor, 0, startAnchors * sizeof(VDFNode*));
}
示例9: NS_ENSURE_ARG_POINTER
NS_IMETHODIMP
nsCollation::AllocateRawSortKey(int32_t strength,
const nsAString& stringIn,
uint8_t** key, uint32_t* outLen)
{
NS_ENSURE_ARG_POINTER(key);
NS_ENSURE_ARG_POINTER(outLen);
nsAutoString stringNormalized(stringIn);
if (strength != kCollationCaseSensitive) {
ToLowerCase(stringNormalized);
}
NS_ConvertUTF16toUTF8 str(stringNormalized);
size_t len = str.Length() + 1;
void *buffer = PR_Malloc(len);
memcpy(buffer, str.get(), len);
*key = (uint8_t *)buffer;
*outLen = len;
return NS_OK;
}
示例10: ToLowerCase
bool
nsChannelClassifier::IsHostnameWhitelisted(nsIURI *aUri,
const nsACString &aWhitelisted)
{
nsAutoCString host;
nsresult rv = aUri->GetHost(host);
if (NS_FAILED(rv) || host.IsEmpty()) {
return false;
}
ToLowerCase(host);
nsCCharSeparatedTokenizer tokenizer(aWhitelisted, ',');
while (tokenizer.hasMoreTokens()) {
const nsCSubstring& token = tokenizer.nextToken();
if (token.Equals(host)) {
LOG(("nsChannelClassifier[%p]:StartInternal skipping %s (whitelisted)",
this, host.get()));
return true;
}
}
return false;
}
示例11: ToUpperCase
mozEnglishWordUtils::myspCapitalization
mozEnglishWordUtils::captype(const nsString &word)
{
char16_t* lword=ToNewUnicode(word);
ToUpperCase(lword,lword,word.Length());
if(word.Equals(lword)){
free(lword);
return AllCap;
}
ToLowerCase(lword,lword,word.Length());
if(word.Equals(lword)){
free(lword);
return NoCap;
}
int32_t length=word.Length();
if(Substring(word,1,length-1).Equals(lword+1)){
free(lword);
return InitCap;
}
free(lword);
return HuhCap;
}
示例12: m_noRepeatActiv
/*******************************
* Constructors and Destructors
******************************/
TimedKey::TimedKey( std::string &keyString, bool repeat, float delay )
:m_activated( false ),
m_noRepeatActiv( false ),
m_pressed( false ),
m_repeat( repeat ),
m_delay( delay ) {
std::string lwrKey = ToLowerCase( keyString );
// Single character keys can easily be casted
if ( lwrKey.size() == 1 ) {
m_kCode = static_cast<sf::Key::Code>( keyString[0] );
} else {
keyMap_type::iterator keyPair = m_extraKeys.find( lwrKey );
if ( keyPair != m_extraKeys.end() ) {
m_kCode = keyPair->second;
} else {
// No key found so associate with Count, which doesn't match any key
m_kCode = sf::Key::Count;
}
}
}
示例13: do_GetService
nsIAtom*
nsLanguageAtomService::GetLocaleLanguage(nsresult *aError)
{
nsresult res = NS_OK;
do {
if (!mLocaleLanguage) {
nsCOMPtr<nsILocaleService> localeService;
localeService = do_GetService(NS_LOCALESERVICE_CONTRACTID);
if (!localeService) {
res = NS_ERROR_FAILURE;
break;
}
nsCOMPtr<nsILocale> locale;
res = localeService->GetApplicationLocale(getter_AddRefs(locale));
if (NS_FAILED(res))
break;
nsAutoString category;
category.AssignWithConversion(NSILOCALE_MESSAGE);
nsAutoString loc;
res = locale->GetCategory(category, loc);
if (NS_FAILED(res))
break;
ToLowerCase(loc); // use lowercase for all language atoms
mLocaleLanguage = do_GetAtom(loc);
}
} while (0);
if (aError)
*aError = res;
return mLocaleLanguage;
}
示例14: NS_WARNING
bool
GMPInfoFileParser::Init(nsIFile* aInfoFile)
{
nsTArray<nsCString> lines;
static const size_t MAX_GMP_INFO_FILE_LENGTH = 5 * 1024;
nsAutoCString info;
if (!ReadIntoString(aInfoFile, info, MAX_GMP_INFO_FILE_LENGTH)) {
NS_WARNING("Failed to read info file in GMP process.");
return false;
}
// Note: we pass "\r\n" to SplitAt so that we'll split lines delimited
// by \n (Unix), \r\n (Windows) and \r (old MacOSX).
SplitAt("\r\n", info, lines);
for (nsCString line : lines) {
// Field name is the string up to but not including the first ':'
// character on the line.
int32_t colon = line.FindChar(':');
if (colon <= 0) {
// Not allowed to be the first character.
// Info field name must be at least one character.
continue;
}
nsAutoCString key(Substring(line, 0, colon));
ToLowerCase(key);
key.Trim(" ");
nsCString* value = new nsCString(Substring(line, colon + 1));
value->Trim(" ");
mValues.Put(key, value); // Hashtable assumes ownership of value.
}
return true;
}
示例15: lower
// Helper routine used in tracking app lists. Converts path
// entries to lower case and stores them in the trackList array.
void nsMIMEInfoWin::ProcessPath(nsCOMPtr<nsIMutableArray>& appList,
nsTArray<nsString>& trackList,
const nsAString& appFilesystemCommand)
{
nsAutoString lower(appFilesystemCommand);
ToLowerCase(lower);
// Don't include firefox.exe in the list
WCHAR exe[MAX_PATH+1];
PRUint32 len = GetModuleFileNameW(NULL, exe, MAX_PATH);
if (len < MAX_PATH && len != 0) {
PRUint32 index = lower.Find(exe);
if (index != -1)
return;
}
nsCOMPtr<nsILocalHandlerApp> aApp;
if (!GetLocalHandlerApp(appFilesystemCommand, aApp))
return;
// Save in our main tracking arrays
appList->AppendElement(aApp, false);
trackList.AppendElement(lower);
}