puts()
printf
("%s"
,p)'
gets()
//記憶體是否合法
scanf
("%s"
,p)
strlen
memset //memset( params初始化物件, 初始化成什麼字元, 多大)
strcpy //strcpy(目標,複製物件)
strncpy //拷貝的最大長度 strncpy(目標,複製物件,長度)
strcat //strcat(乙個字串,需要拼接的另乙個字串)
strcmp //strcmp(需比較的乙個字串,另乙個字串) 一樣則為0
int
main()
strchr //strchr(要被檢索的字串, 要搜尋的字元)
strstr //strstr(要被檢索的字串, 要搜尋的字元)
strtok //做字串分割,strtok(需要分割的字串,需要分割的型別)
char str=
"hello,world,leo,heyheyhey"
;p =
strtok
(str,
",");if
(p !=
null
)//獲取第二個串需要加個null
p =strtok
(null
,",");
printf
("獲取到第二個串p=%s\n"
,p);
/*獲取後面幾個串都需要不斷新增p = strtok)=(null,",");*/
//改進
int i=1;
while()
else
i++;}
strlwr //strlwr(目標字串)
char str=
"hello world"
;//windows環境下要定義成陣列的形態,否則崩潰,linux下是可以的
purts
(strlwr
(str)
);
strupr
#include
#include
#include
intmain()
memset
(pstr,
'\0'
,128
)//初始化,把每個元素都初始化為;\0'
//memset( params初始化物件, 初始化成什麼字元, 多大)
oralce 字串操作常用函式
to number 語法 to number string format nlsparams 目的 將char或varchar2型別的string轉換為乙個number型別的數值,如果指定了format,那麼string應該遵循相應的數字格式。nlsparams的用來指定小數點和錢分位分隔符,以及貨...
字串常用操作。。。
include include include char itoa int value result char malloc sizeof char i 1 for j 0 jint i 65 char p itoa i printf s n p free p p null include incl...
字串常用操作
coding utf 8 import string1 判斷str unicode字串物件 def isastring anobj return isinstance anobj,basestring basesting是str,unicode的父類 defisaint anobj return i...