_ismbslead
, _ismbstrail
, _ismbslead_l
, _ismbstrail_l
執行多位元組字元字串前導位元組和後隨位元組的即時線上測試,並判斷指定的子字串指標是否指向前導位元組或後隨位元組。
重要
這個 API 不能用於在 Windows 執行階段中執行的應用程式。 如需詳細資訊,請參閱 CRT functions not supported in Universal Windows Platform apps (通用 Windows 平台應用程式中不支援的 CRT 函式)。
語法
int _ismbslead(
const unsigned char *str,
const unsigned char *current
);
int _ismbstrail(
const unsigned char *str,
const unsigned char *current
);
int _ismbslead_l(
const unsigned char *str,
const unsigned char *current,
_locale_t locale
);
int _ismbstrail_l(
const unsigned char *str,
const unsigned char *current,
_locale_t locale
);
參數
str
指向字串開頭或先前已知的前導位元組之指標。
current
在字串要進行測試的位置之指標。
locale
要使用的地區設定。
傳回值
_ismbslead
如果字元是前置位元組,則會 _ismbstrail
傳回 -1,如果字元是尾端位元組,則傳回 -1。 如果輸入字串有效,但不是前置位元組或尾端位元組,則這些函式會傳回零。 如果任一引數為 NULL
,則會叫用不正確參數處理常式,如參數驗證 中所述 。 如果允許繼續執行,這些函式會傳回 NULL
,並將 errno
設為 EINVAL
。
備註
因為字串內容也列入考量,_ismbslead
和 _ismbstrail
比 _ismbblead
和 _ismbbtrail
版本慢。
這些有 _l
尾碼的函式版本都相同,不同之處在其與地區設定相關的行為,它們會使用傳入的地區設定參數,而不使用目前的地區設定。 如需詳細資訊,請參閱 Locale。
根據預設,此函式的全域狀態會限定于應用程式。 若要變更此行為,請參閱 CRT 中的全域狀態。
需求
常式 | 必要的標頭 | 選擇性標頭 |
---|---|---|
_ismbslead |
<mbctype.h > 或 < mbstring.h> | <ctype.h > ,* < limits.h > , < stdlib.h> |
_ismbstrail |
<mbctype.h > 或 < mbstring.h> | <ctype.h > ,* < limits.h > , < stdlib.h> |
_ismbslead_l |
<mbctype.h > 或 < mbstring.h> | <ctype.h > ,* < limits.h > , < stdlib.h> |
_ismbstrail_l |
<mbctype.h > 或 < mbstring.h> | <ctype.h > ,* < limits.h > , < stdlib.h> |
* 針對測試條件的資訊清單常數。
如需相容性詳細資訊,請參閱相容性。
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應