tolower
, _tolower
, towlower
, _tolower_l
, _towlower_l
將字元轉換為小寫。
語法
int tolower(
int c
);
int _tolower(
int c
);
int towlower(
wint_t c
);
int _tolower_l(
int c,
_locale_t locale
);
int _towlower_l(
wint_t c,
_locale_t locale
);
參數
c
要轉換的字元。
locale
要用於地區設定特定翻譯的地區設定。
傳回值
這些常式都會將 c
的複本轉換為小寫 (如果可以轉換的話),並傳回結果。 沒有保留傳回值來表示錯誤。
備註
如果可能且相關,這些常式都會將指定的大寫字母轉換成小寫字母。 towlower
的大小寫轉換是地區設定特性。 只有與目前地區設定相關字元的大小寫會變更。 沒有 _l
後置字元的函式會使用目前設定的地區設定。 具有 _l
字尾的函式版本採用地區設定作為參數,並使用該地區設定,而不是目前設定的地區設定。 如需詳細資訊,請參閱 Locale。
若要 _tolower
提供預期的結果, __isascii
而且 isupper
必須同時傳回非零。
根據預設,此函式的全域狀態會限定于應用程式。 若要變更此行為,請參閱 CRT 中的全域狀態。
泛型文字常式對應
TCHAR.H 常式 | _UNICODE 和 _MBCS 未定義 |
_MBCS 定義 |
_UNICODE 定義 |
---|---|---|---|
_totlower |
tolower |
_mbctolower |
towlower |
_totlower_l |
_tolower_l |
_mbctolower_l |
_towlower_l |
注意
_tolower_l
和 _towlower_l
沒有任何地區設定相依性,不是用於直接呼叫。 它們是提供給 _totlower_l
內部使用。
需求
常式 | 必要的標頭 |
---|---|
tolower |
<ctype.h> |
_tolower |
<ctype.h> |
towlower |
<ctype.h > 或 < wchar.h> |
如需相容性詳細資訊,請參閱相容性。
範例
請參閱函 式中的 to
範例。
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應