CString的截取字符串,截取ip:port
清泛原创
				CString截取ip:port,代码如下:
	
		
        
	
	
	
	
	
		
		
	
	
	
	
	
		  		
	    
CString strIpPort = "127.0.0.1:8888";
CString strIp, strPort;
int index = strIpPort.Find(':');
if (index > 0)
{
	strIp = strIpPort.Left(index);
	strPort = strIpPort.Right(strIpPort.GetLength()-index-1);
}
else
{
	AfxMessageBox("字符串格式不对");
}
Left 函数从字符串</a>头部开始截取到index位置,Right 函数从分隔符 ':' 后面开始截取到字符串尾部。     
		 评论加载中,请稍后...
    评论加载中,请稍后...