字串函數及宏

來源:互聯網
上載者:User

標誌字串函數tokenize_string():為每個字串返回一個惟一的標誌

      例如:   int   city_token = tokenize_string("shenzhen");

確認字元是否為ASCII字元宏toascii,該宏定義於標頭檔ctype.h,例如:

     #include <ctype.h>

     int toascii(int  character);

將字元從小寫轉換成大寫宏:_toupper,也定義於標頭檔ctype.h中,也可以使用即時庫函數toupper,例如:

      int    _toupper(int   character);   //不判斷正在轉換的字元是否為小寫,宏對非小寫字元轉換會出錯,速度較快

      int    toupper(int   character);     //只對小寫字元進行轉換

判斷字元是否為十六進位宏:isxdigit:

     例如:isxdigit(character)

判斷字元是否包含空白符:isspace:

    例如:isspace(character)

判斷字元是否為標點符號:ispunct:

     例如:ispunct(character)

判斷字元是大寫還是小寫:islower / isupper

判斷字元是否為數字:isdigit

判斷字元是否為控制符:iscntrl

判斷字元是否包含ASCII值:isascii

判斷字元是否為字母:isalpha

判斷字元是否為數字或字母:isalnum

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.