问题:
如字符串 const char *bb="abcdef;dsfads";
如何截取;号以前的字符串 ,abcdef 论坛链接: http://topic.youkuaiyun.com/u/20100108/16/6eee2c27-2fad-4212-a787-3ab68bf124d7.html?93233
不错的回答
char * nn="abcdef"
如何截取;号以前的字符串 ,abcdef 论坛链接: http://topic.youkuaiyun.com/u/20100108/16/6eee2c27-2fad-4212-a787-3ab68bf124d7.html?93233
不错的回答
char * nn="abcdef"
const char * bb = " abcdef;dsfads " ; int iLen = 0 ; char * pIterator = bb; while ( 1 ) { if ( * pIerator == ' ; ' ) { break ; } ++ iLen; } char * pSubStr = new char [iLen + 1 ]; pSubStr[iLen] = 0 ; memcpy(pSubStr,bb,iLen);