69,371
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
char arrDest[] = "3367B.1.1";
int i = 0;
while (arrDest[i])
{
if (arrDest[i] == '.')
{
arrDest[i] = '\0';
break;
}
i++;
}
cout << arrDest << endl;
return 0;
}
int i = 0;
while (arrDest[i])
{
if (arrDest[i] == '.')
{
arrDest[i] = '\0';
break;
}
i++;
}
char s[]="3367B.1-1";
char t[20],*p;
strcpy(t,s);
p=strchr(t,'.');
if (p) *p=0;
printf("[%s]\n",t);
string s = "abc.d";
int i = s.find_first_of(".");
string news = s.substr(0,i);