W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
strcspn() 函數(shù)返回在找到任何指定的字符之前,在字符串查找的字符數(shù)(包括空格)。
提示: Use the strspn() function to the number of characters found in the string that contains only characters from a specified character list.
注釋: This function is binary-safe.
參數(shù) | 描述 |
---|---|
string | 必需。規(guī)定要搜索的字符串。 |
char | 必需。規(guī)定要查找的字符。 |
start | 可選。規(guī)定開始查找的位置。 |
length | 可選。規(guī)定字符串的長度(搜索多少字符)。 |
返回值: | 返回在找到任何指定的字符之前,在字符串查找的字符數(shù)。 |
---|---|
PHP 版本: | 4+ |
更新日志: | 在 PHP 4.3 中,新增了 start 和 length 參數(shù)。 |
使用所有的參數(shù)來輸出在字符串 "Hello world!" 中找到字符 "w" 之前查找的字符數(shù):
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: